Invalid Command Factory Error
Trace a generated Command client value without a callable invocation shape.What this error means and what can trigger it
InvalidCommandFactoryError means the client Command adapter received neither a callable value nor a non-null object with a callable invoke method. SER supports both shapes because SvelteKit output and compatibility paths can represent a Command either way.
This generally points to an integration problem, such as an incorrect import, stale generated module, or compiler/runtime version mismatch. A malformed direct call to the internal adapter can produce it too, although application code should never call that adapter.
Exactly where it triggers
const invoke = has_method(native_factory, "invoke")
? native_factory.invoke.bind(native_factory)
: undefined;
const command = typeof native_factory === "function" ? native_factory : undefined;
if (!command && !invoke) {
throw new InvalidCommandFactoryError();
}The check runs synchronously while generated client exports are initialized. The compiler emits the adapter call at modules/svelte-effect-runtime/src/compiler/remote-client.ts L118 @ C10. No Command effect or network request has started.
For reference, the class itself is declared at modules/svelte-effect-runtime/src/errors.ts L627 @ C14.
Why this is the case
The adapter's execution path later calls either invoke(input) or the direct function. Accepting any other value would postpone a fixed integration error until the first mutation and would leave the adapter's pending-state bridge attached to an operation it cannot invoke.
The early shape guard also avoids relying on accidental object callability or property presence. The selected property must be an actual function and is bound to its source object before use.