sveltejs/kit · error · Error
Cannot call '${__.name}(...).updates(...)' on the server
Error message
Cannot call '${__.name}(...).updates(...)' on the server What it means
Runtime guard on the promise returned by a remote command: the .updates() method is a client-only API for applying optimistic updates after a command resolves. On the server there is no reactive UI to update, so calling it there is unconditionally rejected by this stub.
Source
Thrown at packages/kit/src/runtime/app/server/remote/command.js:91
const violation =
state.is_in_remote_query || state.is_in_remote_prerender
? `inside a query or prerender function`
: `from a ${event.request.method} handler`;
throw new Error(`Cannot call a command (${__.name}) ${violation}`);
}
if (state.is_in_render) {
throw new Error(`Cannot call a command (${__.name}) during server-side rendering`);
}
const promise = Promise.resolve(
run_remote_function(event, state, true, () => validate(arg), fn)
);
// @ts-expect-error
promise.updates = () => {
throw new Error(`Cannot call '${__.name}(...).updates(...)' on the server`);
};
return /** @type {ReturnType<RemoteCommand<Input, Output>>} */ (promise);
};
Object.defineProperty(wrapper, '__', { value: __ });
// On the server, pending is always 0
Object.defineProperty(wrapper, 'pending', {
get: () => 0
});
return wrapper;
}
View on GitHub (pinned to 03f1687fe6)
Solutions
- Only call .updates() in browser code, e.g. inside a form action callback that runs client-side
- Gate the call with a $browser/ON_BROWSER check if the code is shared
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/kit/src/runtime/app/server/remote/command.js:91 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/a23bddace724ab4f.
Report an issue: GitHub.