sveltejs/kit · error
Multiple overrides for the same query are not allowed in a s
Error message
Multiple overrides for the same query are not allowed in a single updates() invocation
What it means
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.
Source
Thrown at packages/kit/src/runtime/client/remote-functions/shared.svelte.js:269
if (entries) {
for (const payload of entries.keys()) {
refreshes.add(create_remote_key(id, payload));
}
}
continue;
}
if (Object.hasOwn(update, QUERY_OVERRIDE_KEY)) {
// this is a query override release function, so we need to both request that the query instance
// be refreshed _and_ stash the release function so we can release the override after the command completes
// @ts-expect-error
const key = /** @type {string} */ (update[QUERY_OVERRIDE_KEY]);
refreshes.add(key);
if (override_keys.has(key)) {
throw new Error(
'Multiple overrides for the same query are not allowed in a single updates() invocation'
);
}
override_keys.add(key);
overrides.push(/** @type {() => void} */ (update));
continue;
}
// this is just a regular function provided by some user integration, so we can just stash it in the overrides array
overrides.push(/** @type {() => void} */ (update));
continue;
}
if (
typeof update === 'object' &&
update !== null &&
Object.hasOwn(update, QUERY_RESOURCE_KEY)View on GitHub (pinned to 03f1687fe6)
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.
Example fix
// before updates([queryOverride(getTodos), otherUpdate, queryOverride(getTodos)]); // after updates([queryOverride(getTodos), otherUpdate]);
Defensive patterns
Strategy: validation
Validate before calling
const keys = updates.map((u) => u[QUERY_OVERRIDE_KEY]).filter(Boolean);
if (new Set(keys).size !== keys.length) throw new Error('duplicate query override in updates()'); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- refreshAll() is invalid for live queries. Use reconnectAll()
- reconnectAll() is invalid for regular queries. Use refreshAl
- updates() expects a query or live query function, query reso
- The SvelteKit Vite plugin ${keypath} should be an object wit
- Could not get the request store.
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/63e4990000477266.
Report an issue: GitHub.