sveltejs/kit · error
updates() expects a query or live query function, query reso
Error message
updates() expects a query or live query function, query resource, or query override
What it means
Every element passed to updates() inside a command function or submit must be a query function, live query function, query resource, or a query override created by the library. Anything else (a plain value, unknown function, or malformed entry) fails categorize_updates and throws this error.
Source
Thrown at packages/kit/src/runtime/client/remote-functions/shared.svelte.js:295
}
// 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)
) {
// this is a query instance, so we just need to request that it be refreshed
// @ts-expect-error
refreshes.add(/** @type {string} */ (update[QUERY_RESOURCE_KEY]));
continue;
}
throw new Error(
'updates() expects a query or live query function, query resource, or query override'
);
}
return { overrides, refreshes };
}
View on GitHub (pinned to 03f1687fe6)
Solutions
- Only pass query functions, live query functions, query resources, or overrides returned by the library's query helpers into updates().
- If you meant to refresh a query, pass the query function itself (optionally with args) rather than its awaited result.
- Check imports: the item must originate from .remote.ts/.remote.js exports, not a locally defined function.
Example fix
// before
updates([async () => { await getTodos(); }]);
// after
updates([getTodos]); Defensive patterns
Strategy: type-guard
Type guard
function isQueryable(u) {
return (
typeof u === 'function' ||
(u != null && typeof u === 'object' && (QUERY_OVERRIDE_KEY in u || QUERY_RESOURCE_KEY in u || QUERY_KEY in u))
);
}
// updates(items.every(isQueryable) ? items : []) Try / catch
try {
runCommand(data, updates(items));
} catch (e) {
if (e.message.startsWith('updates() expects')) console.error('non-query passed to updates()', items);
else throw e;
} Prevention
- Pass query functions/resources, never their awaited results or Promises.
- Only use exports from your .remote.ts module inside updates().
- Rely on TypeScript so invalid entries are rejected at compile time.
When it happens
Trigger: Passing a plain function that is not a query, a Promise, an object, a string, or a query created outside the library's remote query system into the updates() array.
Common situations: Passing the result of calling a query (its returned value/Promise) instead of the query function itself; mixing in arbitrary effect code; typos in imports so a helper returns something unexpected.
Related errors
- refreshAll() is invalid for live queries. Use reconnectAll()
- reconnectAll() is invalid for regular queries. Use refreshAl
- Multiple overrides for the same query are not allowed in a s
- The SvelteKit Vite plugin ${keypath} should be an object wit
- ${keypath} must be an array of strings
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/124741a60cd152b2.
Report an issue: GitHub.