{"record":{"id":"8dc102475964bdfb","repo":"sveltejs/kit","slug":"reconnectall-is-invalid-for-regular-queries-use","errorCode":null,"errorMessage":"reconnectAll() is invalid for regular queries. Use refreshAll() instead.","messagePattern":"reconnectAll\\(\\) is invalid for regular queries\\. Use refreshAll\\(\\) instead\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/runtime/app/server/remote/requested.js","lineNumber":219,"sourceCode":"\t\t\t\t\t};\n\t\t\t\t} catch (error) {\n\t\t\t\t\trecord_failure(payload, error);\n\t\t\t\t\tthrow new Error(`Skipping ${__.name}(${payload})`, { cause: error });\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tasync refreshAll() {\n\t\t\tif (__.type === 'query_live') {\n\t\t\t\tthrow new Error('refreshAll() is invalid for live queries. Use reconnectAll() instead.');\n\t\t\t}\n\n\t\t\tfor await (const { query } of result) {\n\t\t\t\tvoid (/** @type {RemoteQuery<Output>} */ (query).refresh());\n\t\t\t}\n\t\t},\n\t\tasync reconnectAll() {\n\t\t\tif (__.type !== 'query_live') {\n\t\t\t\tthrow new Error('reconnectAll() is invalid for regular queries. Use refreshAll() instead.');\n\t\t\t}\n\n\t\t\tfor await (const { query } of result) {\n\t\t\t\tvoid (/** @type {RemoteLiveQuery<Output>} */ (query).reconnect());\n\t\t\t}\n\t\t},\n\t\tasync ignoreAll() {\n\t\t\tfor await (const { ignore } of result) ignore();\n\t\t}\n\t};\n\n\treturn /** @type {RequestedResult<Validated, Output>} */ (/** @type {unknown} */ (result));\n}\n\n/**\n * @template T\n * @param {Array<T>} array\n * @param {number} limit","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/app/server/remote/requested.js#L201-L237","documentation":"`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.","triggerScenarios":"Calling `requested(myQuery, limit).reconnectAll()` where `myQuery` was created with `query(...)` (type not `query_live`).","commonSituations":"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.","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`."],"exampleFix":"// before\nwindow.addEventListener('online', () => requested(products, Infinity).reconnectAll());\n// after\nwindow.addEventListener('online', () => requested(products, Infinity).refreshAll());","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"function isRegularQueryBatch(fn) { return fn.type !== 'query_live'; }","tryCatchPattern":"try {\n  if (isRegularQueryBatch(myQuery)) await batch.refreshAll();\n  else await batch.reconnectAll();\n} catch (e) {\n  console.error(e.message);\n}","preventionTips":["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."],"tags":["remote-functions","queries","api-misuse"],"backgroundTag":"wrong-refresh-method-for-live-query","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}