{"record":{"id":"4ca487b7b3df8dc8","repo":"sveltejs/kit","slug":"updates-can-only-be-sent-once-per-command-invocati","errorCode":null,"errorMessage":"Updates can only be sent once per command invocation. Ignoring additional updates.","messagePattern":"Updates can only be sent once per command invocation\\. Ignoring additional updates\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/client/remote-functions/command.svelte.js","lineNumber":87,"sourceCode":"\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfail_unhandled_refreshes(refreshes);\n\n\t\t\t\t\t\treturn response._;\n\t\t\t\t\t} finally {\n\t\t\t\t\t\toverrides?.forEach((fn) => fn());\n\n\t\t\t\t\t\t// Decrement pending count when command completes\n\t\t\t\t\t\tpending_count--;\n\t\t\t\t\t}\n\t\t\t\t})()\n\t\t\t);\n\n\t\tlet updates_called = false;\n\t\tpromise.updates = (...args) => {\n\t\t\tif (updates_called) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'Updates can only be sent once per command invocation. Ignoring additional updates.'\n\t\t\t\t);\n\t\t\t\treturn promise;\n\t\t\t}\n\t\t\tupdates_called = true;\n\n\t\t\ttry {\n\t\t\t\t({ refreshes, overrides } = categorize_updates(args));\n\t\t\t} catch (error) {\n\t\t\t\tupdates_error = /** @type {Error} */ (error);\n\t\t\t}\n\n\t\t\treturn promise;\n\t\t};\n\n\t\treturn promise;\n\t};\n","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/client/remote-functions/command.svelte.js#L69-L105","documentation":"Remote `command` functions return a promise with an `.updates(...)` method used to stream incremental updates to the client. The runtime warns and ignores subsequent calls if `.updates()` is invoked more than once for a single command invocation, since only one update payload per invocation is supported. The original promise is still returned.","triggerScenarios":"Calling `promise.updates(...)` two or more times on the promise returned by a single remote command invocation, e.g. calling it in a loop or in multiple code paths for the same command call.","commonSituations":"Attempting to send progress updates repeatedly inside a long-running command; refactored code where both a helper and the caller call `.updates()` for the same invocation.","solutions":["Call `.updates(...)` exactly once per command invocation, aggregating all data into that call","If multiple updates are needed, restructure to one command per update or batch results","Guard your own code so helper functions don't double-call `.updates`"],"exampleFix":"// before\nconst p = createItem();\np.updates({ step: 1 });\np.updates({ step: 2 }); // ignored + warning\n// after\nconst p = createItem();\np.updates({ steps: [1, 2] }); // single update per invocation","handlingStrategy":"validation","validationCode":"const sendUpdate = (p, data) => { if (p.__updateSent) throw new Error('updates already sent'); p.__updateSent = true; p.updates(data); };","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Call .updates() exactly once per command invocation","Batch all progress data into a single updates payload","Wrap .updates in a helper that tracks a per-invocation sent flag"],"tags":["remote-functions","command","updates","sveltekit"],"backgroundTag":"updates-called-twice","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}