Invalid Live Query Factory Error
Trace invalid live Query factories, resources, and reconnect metadata.What this error means and what can trigger it
InvalidLiveQueryFactoryError covers three distinct live-query shape invariants.
The first invariant is simple: the generated native factory must be callable. Once called, it must produce a value with a callable Symbol.asyncIterator, which rules out ordinary query resources, arrays, primitives, and arbitrary objects. Reconnection adds one more requirement because Live.reconnect(stream) needs hidden live metadata whose native resource exposes a callable reconnect method.
One wrinkle is that the diagnostic message mentions an object with a query method, although the 4.0.0 client adapter accepts only a function at that boundary. The async-iterable validator and reconnect path inspect different shapes later on.
Exactly where it triggers
Non-callable client factory, thrown synchronously during adapter creation:
if (typeof native_factory !== "function") {
throw new InvalidLiveQueryFactoryError();
}Factory result without a callable async iterator, thrown synchronously by the live resource validator:
if (!is_async_iterable_resource(resource)) {
throw new InvalidLiveQueryFactoryError();
}Missing reconnect metadata or method, returned as a lazy effect failure:
if (!metadata || typeof metadata.resource.reconnect !== "function") {
return Effect.fail(new InvalidLiveQueryFactoryError()) as unknown as Effect.Effect<
void,
RemoteFailure<E>
>;
}The third path behaves differently: it is not a synchronous throw. It becomes a typed failure only when the reconnect effect runs. For reference, the class itself is declared at modules/svelte-effect-runtime/src/errors.ts L607 @ C14.
Why this is the case
A Stream from Effect can be built from a native async iterable only when that protocol is actually present. The explicit validator protects Stream.fromAsyncIterable from receiving a lookalike resource with unrelated methods.
Reconnect is stricter still. SER attaches hidden metadata only when it creates a remote live Stream, preserving the native resource needed for reconnection. A plain Stream cast to the remote type has no such resource, and a native resource without reconnect cannot perform the requested operation.