sveltejs/kit · error

refreshAll() is invalid for live queries. Use reconnectAll()

Error message

refreshAll() is invalid for live queries. Use reconnectAll() instead.

What it means

`refreshAll()` re-runs regular queries to fetch fresh data; live queries instead maintain a server-push subscription, so refreshing them is meaningless. SvelteKit throws this to redirect you to `reconnectAll()`, which re-establishes the underlying live connections.

Source

Thrown at packages/kit/src/runtime/app/server/remote/requested.js:210

			yield* race_all(selected, async (payload) => {
				consume(payload);
				try {
					const parsed = parse_remote_arg(payload);
					const validated = await __.validate(parsed);
					return {
						arg: validated,
						query: __.bind(payload, validated),
						ignore: create_ignore(payload)
					};
				} 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();
		}

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Replace `.refreshAll()` with `.reconnectAll()` for live-query batches.
  2. Keep separate helper functions for refreshing regular vs live batches.
  3. If the data should be pull-based, change the remote function from `query.live` to `query`.

Example fix

// before
await requested(liveNotifications, Infinity).refreshAll();
// after
await requested(liveNotifications, Infinity).reconnectAll();
Defensive patterns

Strategy: type-guard

Type guard

function isLiveQueryBatch(fn) { return fn.type === 'query_live'; }

Try / catch

try {
  if (isLiveQueryBatch(myQuery)) await batch.reconnectAll();
  else await batch.refreshAll();
} catch (e) {
  console.error(e.message);
}

Prevention

When it happens

Trigger: Calling `requested(myLiveQuery, limit).refreshAll()` where `myLiveQuery` was created with `query.live(...)` (type `query_live`).

Common situations: Copy-pasting refresh logic written for regular queries into a component that batch-iterates live queries; refactoring a `query` into `query.live` without updating the refresh calls.

Related errors


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/938091fea9a83596. Report an issue: GitHub.