{"record":{"id":"0c8edefa531a2c11","repo":"sveltejs/kit","slug":"updates-can-only-be-sent-once-per-form-submission","errorCode":null,"errorMessage":"Updates can only be sent once per form submission. Ignoring additional updates.","messagePattern":"Updates can only be sent once per form submission\\. Ignoring additional updates\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/client/remote-functions/form.svelte.js","lineNumber":311,"sourceCode":"\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\toverrides?.forEach((fn) => fn());\n\n\t\t\t\t\t\t\tvoid tick().then(() => {\n\t\t\t\t\t\t\t\tif (entry) {\n\t\t\t\t\t\t\t\t\tentry.count--;\n\t\t\t\t\t\t\t\t\tif (entry.count === 0) {\n\t\t\t\t\t\t\t\t\t\tinstances.delete(key);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t})()\n\t\t\t\t);\n\n\t\t\tlet updates_called = false;\n\t\t\tpromise.updates = (...args) => {\n\t\t\t\tif (updates_called) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t'Updates can only be sent once per form submission. Ignoring additional updates.'\n\t\t\t\t\t);\n\t\t\t\t\treturn promise;\n\t\t\t\t}\n\t\t\t\tupdates_called = true;\n\n\t\t\t\ttry {\n\t\t\t\t\t({ refreshes, overrides } = categorize_updates(args));\n\t\t\t\t} catch (error) {\n\t\t\t\t\tupdates_error = /** @type {Error} */ (error);\n\t\t\t\t}\n\n\t\t\t\treturn promise;\n\t\t\t};\n\n\t\t\treturn promise;\n\t\t}\n","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/client/remote-functions/form.svelte.js#L293-L329","documentation":"Remote form submissions return a promise with an `.updates(...)` method for sending incremental updates during submission. The runtime warns and ignores extra calls if `.updates()` is invoked more than once per single form submission, mirroring the command-function restriction. The promise itself is still returned and the first update stands.","triggerScenarios":"Calling `promise.updates(...)` more than once on the promise produced by one form submission (e.g. from `callback`, the enhance callback instance, or the submission path calling it twice).","commonSituations":"Sending progress updates at multiple stages of a long form action; duplicated calls after refactoring submit handlers; framework code paths both invoking updates for the same submission.","solutions":["Call `.updates(...)` once per submission, combining all data into one payload","Split long-running work into separate commands if multiple update stages are required","Audit submit/enhance callbacks so only one code path calls `.updates`"],"exampleFix":"// before\nconst p = myForm.submit();\np.updates({ stage: 'validating' });\np.updates({ stage: 'saving' }); // ignored + warning\n// after\nconst p = myForm.submit();\np.updates({ stages: ['validating', 'saving'] });","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() once per form submission only","Centralize submission update logic in one place (e.g. the enhance callback)","Batch multi-stage progress into a single updates payload"],"tags":["remote-functions","form","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"}