sveltejs/kit · error
reconnectAll() is invalid for regular queries. Use refreshAl
Error message
reconnectAll() is invalid for regular queries. Use refreshAll() instead.
What it means
`reconnectAll()` only applies to live queries, which hold a server-push connection that can be re-established. Regular queries are plain request/response and have nothing to reconnect, so SvelteKit throws this and points you to `refreshAll()`, which re-executes them.
Source
Thrown at packages/kit/src/runtime/app/server/remote/requested.js:219
};
} catch (error) {
record_failure(payload, error);
throw new Error(`Skipping ${__.name}(${payload})`, { cause: error });
}
});
},
async refreshAll() {
if (__.type === 'query_live') {
throw new Error('refreshAll() is invalid for live queries. Use reconnectAll() instead.');
}
for await (const { query } of result) {
void (/** @type {RemoteQuery<Output>} */ (query).refresh());
}
},
async reconnectAll() {
if (__.type !== 'query_live') {
throw new Error('reconnectAll() is invalid for regular queries. Use refreshAll() instead.');
}
for await (const { query } of result) {
void (/** @type {RemoteLiveQuery<Output>} */ (query).reconnect());
}
},
async ignoreAll() {
for await (const { ignore } of result) ignore();
}
};
return /** @type {RequestedResult<Validated, Output>} */ (/** @type {unknown} */ (result));
}
/**
* @template T
* @param {Array<T>} array
* @param {number} limitView on GitHub (pinned to 03f1687fe6)
Solutions
- Replace `.reconnectAll()` with `.refreshAll()` for regular-query batches.
- Branch on the query type (live vs regular) before choosing the maintenance call.
- If reconnection semantics are needed, declare the remote function with `query.live`.
Example fix
// before
window.addEventListener('online', () => requested(products, Infinity).reconnectAll());
// after
window.addEventListener('online', () => requested(products, Infinity).refreshAll()); Defensive patterns
Strategy: type-guard
Type guard
function isRegularQueryBatch(fn) { return fn.type !== 'query_live'; } Try / catch
try {
if (isRegularQueryBatch(myQuery)) await batch.refreshAll();
else await batch.reconnectAll();
} catch (e) {
console.error(e.message);
} Prevention
- Branch on query kind before choosing refreshAll vs reconnectAll.
- Only attach 'online/reconnect' handlers to live-query batches.
- Search call sites for reconnectAll when demoting a live query to a regular one.
When it happens
Trigger: Calling `requested(myQuery, limit).reconnectAll()` where `myQuery` was created with `query(...)` (type not `query_live`).
Common situations: Swapping a live query for a regular query (or vice versa) without updating batch maintenance code; applying a shared 'reconnect on network restore' handler to all query batches.
Related errors
- refreshAll() is invalid for live queries. Use reconnectAll()
- Cannot set cookies in `query` or `prerender` functions
- Cannot delete cookies in `query` or `prerender` functions
- Multiple overrides for the same query are not allowed in a s
- updates() expects a query or live query function, query reso
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/8dc102475964bdfb.
Report an issue: GitHub.