Invalid Query Factory Error
Trace a generated Query client value that has no callable transport shape.What this error means and what can trigger it
InvalidQueryFactoryError means the client adapter received neither a callable native factory nor a non-null object with a callable load method. The error is raised while the adapter is created, usually during evaluation of the generated client module.
This usually means a SvelteKit-generated export is missing or incompatible, generated code is stale, or the compiler and runtime disagree about the boundary. Calling SER's internal adapter with the wrong value can also reach this error, although application code should not call that adapter directly.
One wrinkle is that the current message mentions objects exposing query or load. In 4.0.0, however, the implementation accepts a direct function or an object with load; an object exposing only query still fails. The behavior described here follows the implemented predicate.
Exactly where it triggers
const load = has_method(native_factory, "load")
? native_factory.load.bind(native_factory)
: undefined;
const query = typeof native_factory === "function" ? native_factory : undefined;
if (!query && !load) {
throw new InvalidQueryFactoryError();
}has_method requires a non-null object and a callable property. The throw is synchronous and occurs before the wrapped Query effect is returned. Generated code calls this adapter from modules/svelte-effect-runtime/src/compiler/remote-client.ts L129 @ C2.
For reference, the class itself is declared at modules/svelte-effect-runtime/src/errors.ts L587 @ C14.
Why this is the case
Every later Query execution must choose one concrete operation: call the factory with the input, or call its bound load method. A value satisfying neither branch cannot initiate a request.
Checking during adapter construction turns a deterministic integration mismatch into a module-level diagnostic. Deferring it until the Query effect runs would make the failure dependent on user interaction and obscure which generated boundary supplied the malformed value.