sveltejs/kit · error · HandledHttpError
Query resolved without a value
Error message
Query resolved without a value
What it means
A Query's promise resolves only when the query has a value (#ready). If the underlying promise settles but no value was ever set, the client throws a HandledHttpError (500 by default, or the stored #error), meaning the query resolved without producing a value.
Source
Thrown at packages/kit/src/runtime/client/remote-functions/query/instance.svelte.js:54
// don't reduce undefined value
if (!this.#ready) return undefined;
return this.#overrides.reduce((v, r) => r(v), /** @type {T} */ (this.#raw));
});
/** @type {App.Error | undefined} */
#error = $state.raw(undefined);
/** @type {Promise<T>['then']} */
// @ts-expect-error TS doesn't understand that the promise returns something
#then = $derived.by(() => {
const p = this.#get_promise();
this.#overrides.length;
return (resolve, reject) => {
const result = p.then(tick).then(() => {
if (!this.#ready) {
throw new HandledHttpError(
this.#error ?? { status: 500, message: 'Query resolved without a value' }
);
}
return /** @type {T} */ (this.#current);
});
if (resolve || reject) {
return result.then(resolve, reject);
}
return result;
};
});
/**
* @param {string} key
* @param {() => Promise<T>} fnView on GitHub (pinned to 03f1687fe6)
Solutions
- Ensure the remote query function always returns a value for every code path
- Check the server handler for early returns/undefined results and add logging
- Inspect overrides/cancel logic so a query is not left in a non-ready settled state
- Update @sveltejs/kit — resolution handling in queries changed across releases
Example fix
// before
export const getUser = query(async (id) => {
if (!id) return; // resolves without a value
return db.users.get(id);
});
// after
export const getUser = query(async (id) => {
if (!id) error(400, 'id required');
return db.users.get(id);
}); Defensive patterns
Strategy: try-catch
Try / catch
try {
const value = await userQuery;
} catch (e) {
// HandledHttpError — Query resolved without a value
showFallback(e.status ?? 500);
} Prevention
- Ensure remote query functions return a value on every path
- Use error(...) instead of bare returns for invalid input
- Test all conditional branches of remote query functions
When it happens
Trigger: The remote query function's returned promise resolved without the query instance receiving a value — e.g. the server handler returned undefined, an override was applied without a value, or the query errored in a way that left #error unset and #ready false when the awaited chain completed.
Common situations: Remote query function that conditionally returns nothing; awaiting a query that was never properly started; race where an error/override path skipped setting the current value; server bug returning an empty result the client can't adopt.
Related errors
- Cannot call query '${__.name}' while prerendering, as preren
- Cannot call '${__.name}.withOverride()' on the server
- requested(...) expects a query function created with query(.
- Cannot access event.${property} in a query. Pass the value a
- Could not get the request store.
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/1a7ffea361bf8ad8.
Report an issue: GitHub.