{"record":{"id":"63e4990000477266","repo":"sveltejs/kit","slug":"multiple-overrides-for-the-same-query-are-not-allo","errorCode":null,"errorMessage":"Multiple overrides for the same query are not allowed in a single updates() invocation","messagePattern":"Multiple overrides for the same query are not allowed in a single updates\\(\\) invocation","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/runtime/client/remote-functions/shared.svelte.js","lineNumber":269,"sourceCode":"\n\t\t\t\tif (entries) {\n\t\t\t\t\tfor (const payload of entries.keys()) {\n\t\t\t\t\t\trefreshes.add(create_remote_key(id, payload));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (Object.hasOwn(update, QUERY_OVERRIDE_KEY)) {\n\t\t\t\t// this is a query override release function, so we need to both request that the query instance\n\t\t\t\t// be refreshed _and_ stash the release function so we can release the override after the command completes\n\t\t\t\t// @ts-expect-error\n\t\t\t\tconst key = /** @type {string} */ (update[QUERY_OVERRIDE_KEY]);\n\t\t\t\trefreshes.add(key);\n\n\t\t\t\tif (override_keys.has(key)) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t'Multiple overrides for the same query are not allowed in a single updates() invocation'\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\toverride_keys.add(key);\n\t\t\t\toverrides.push(/** @type {() => void} */ (update));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// this is just a regular function provided by some user integration, so we can just stash it in the overrides array\n\t\t\toverrides.push(/** @type {() => void} */ (update));\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (\n\t\t\ttypeof update === 'object' &&\n\t\t\tupdate !== null &&\n\t\t\tObject.hasOwn(update, QUERY_RESOURCE_KEY)","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/client/remote-functions/shared.svelte.js#L251-L287","documentation":"SvelteKit's updates() (used by command functions and submit) accepts a list of query overrides and refreshes to apply while/after a remote command runs. Each query may be overridden at most once per invocation, so the library throws when the same query key appears in multiple overrides. This prevents ambiguous semantics about which override wins.","triggerScenarios":"Passing the same query override function (or two overrides resolving to the same QUERY_OVERRIDE_KEY) more than once in a single updates([...]) array, e.g. listing a query twice or overriding it in two elements.","commonSituations":"Copy-pasting an updates() array and forgetting to remove a duplicate entry; combining two update items that both wrap the same query with different args; refactoring code that merged two update lists without deduping.","solutions":["Remove the duplicate override so each query override key appears at most once in the updates() array.","If multiple overrides of the same query are needed sequentially, split them into separate commands or apply refreshes after the command completes.","Deduplicate by key before calling updates(), e.g. filter the array so only the last override for each key survives."],"exampleFix":"// before\nupdates([queryOverride(getTodos), otherUpdate, queryOverride(getTodos)]);\n// after\nupdates([queryOverride(getTodos), otherUpdate]);","handlingStrategy":"validation","validationCode":"const keys = updates.map((u) => u[QUERY_OVERRIDE_KEY]).filter(Boolean);\nif (new Set(keys).size !== keys.length) throw new Error('duplicate query override in updates()');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep updates() arrays short and literal; avoid building them by concatenating lists that may repeat queries.","Deduplicate by override key before invoking updates().","Prefer listing the query function (refresh) over overriding the same query twice."],"tags":["remote-functions","api-misuse","duplicate-key"],"backgroundTag":"duplicate-override-key","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}