sveltejs/kit · warning

${node.server_id}: Accessing `params.${String(key)}` in a pr

Error message

${node.server_id}: Accessing `params.${String(key)}` in a promise handler after `load(...)` has returned will not cause the function to re-run when the param changes

What it means

SvelteKit proxies `params` in server `load` to track which individual params the load function reads. Reading a param in a promise handler after `load` has returned bypasses tracking, so navigating to a URL where only that param changes will not re-run the load function.

Source

Thrown at packages/kit/src/runtime/server/page/load_data.js:120

							const { href } = new URL(dep, event.url);

							if (DEV) {
								validate_depends(node.server_id || 'missing route ID', dep);

								if (done && !uses.dependencies.has(href)) {
									console.warn(
										`${node.server_id}: Calling \`depends(...)\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the dependency is invalidated`
									);
								}
							}

							uses.dependencies.add(href);
						}
					},
					params: new Proxy(event.params, {
						get: (target, key) => {
							if (DEV && done && typeof key === 'string' && !uses.params.has(key)) {
								console.warn(
									`${node.server_id}: Accessing \`params.${String(
										key
									)}\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the param changes`
								);
							}

							if (is_tracking) {
								uses.params.add(key);
							}
							return target[/** @type {string} */ (key)];
						}
					}),
					parent: async () => {
						if (DEV && done && !uses.parent) {
							console.warn(
								`${node.server_id}: Calling \`parent(...)\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when parent data changes`
							);
						}

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Read all needed `params` keys synchronously at the top of `load`, before any `await`.
  2. Copy param values into local constants and pass those into async continuations.
  3. Destructure `const { id, slug } = params` immediately in the load body.

Example fix

// before
export function load({ params }) {
  return getData().then((d) => ({ d, id: params.id }));
}
// after
export async function load({ params }) {
  const { id } = params;
  const d = await getData();
  return { d, id };
}
Defensive patterns

Strategy: validation

Validate before calling

export async function load({ params }) {
  const { id, slug } = params; // destructure immediately so reads are tracked
  const data = await getData(id, slug);
  return { data };
}

Prevention

When it happens

Trigger: Server `load` reads `params.slug` (or any param key) inside a `.then()`/post-await continuation after the body completed and that key was never read while tracking.

Common situations: Using `params.id` inside a fetch callback or `then` after awaiting; destructuring params lazily in async helpers invoked from a promise chain.

Related errors


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