{"record":{"id":"a23bddace724ab4f","repo":"sveltejs/kit","slug":"cannot-call-name-updates-on-the","errorCode":null,"errorMessage":"Cannot call '${__.name}(...).updates(...)' on the server","messagePattern":"Cannot call '(.+?)\\(\\.\\.\\.\\)\\.updates\\(\\.\\.\\.\\)' on the server","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/runtime/app/server/remote/command.js","lineNumber":91,"sourceCode":"\t\t\tconst violation =\n\t\t\t\tstate.is_in_remote_query || state.is_in_remote_prerender\n\t\t\t\t\t? `inside a query or prerender function`\n\t\t\t\t\t: `from a ${event.request.method} handler`;\n\n\t\t\tthrow new Error(`Cannot call a command (${__.name}) ${violation}`);\n\t\t}\n\n\t\tif (state.is_in_render) {\n\t\t\tthrow new Error(`Cannot call a command (${__.name}) during server-side rendering`);\n\t\t}\n\n\t\tconst promise = Promise.resolve(\n\t\t\trun_remote_function(event, state, true, () => validate(arg), fn)\n\t\t);\n\n\t\t// @ts-expect-error\n\t\tpromise.updates = () => {\n\t\t\tthrow new Error(`Cannot call '${__.name}(...).updates(...)' on the server`);\n\t\t};\n\n\t\treturn /** @type {ReturnType<RemoteCommand<Input, Output>>} */ (promise);\n\t};\n\n\tObject.defineProperty(wrapper, '__', { value: __ });\n\n\t// On the server, pending is always 0\n\tObject.defineProperty(wrapper, 'pending', {\n\t\tget: () => 0\n\t});\n\n\treturn wrapper;\n}\n","sourceCodeStart":73,"sourceCodeEnd":106,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/app/server/remote/command.js#L73-L106","documentation":"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.","triggerScenarios":"Thrown at packages/kit/src/runtime/app/server/remote/command.js:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}