sveltejs/kit · warning
${node.server_id}: Accessing `route.${String(key)}` in a pro
Error message
${node.server_id}: Accessing `route.${String(key)}` in a promise handler after `load(...)` has returned will not cause the function to re-run when the route changes What it means
SvelteKit proxies `route` (the matched route's `id`/params metadata) in server `load` to track reads. Accessing `route` in a promise handler after `load` has returned escapes tracking, so navigating between routes will not re-run the load function as expected.
Source
Thrown at packages/kit/src/runtime/server/page/load_data.js:148
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`
);
}
if (is_tracking) {
uses.parent = true;
}
return parent();
},
route: new Proxy(event.route, {
get: (target, key) => {
if (DEV && done && typeof key === 'string' && !uses.route) {
console.warn(
`${node.server_id}: Accessing \`route.${String(
key
)}\` in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the route changes`
);
}
if (is_tracking) {
uses.route = true;
}
return target[/** @type {'id'} */ (key)];
}
}),
url,
untrack(fn) {
is_tracking = false;
try {
return fn();
} finally {View on GitHub (pinned to 03f1687fe6)
Solutions
- Read `route.id` (and any other route properties) synchronously at the top of `load`.
- Capture the route id into a local variable before awaiting and use that in continuations.
- Remove post-return route access if it was only for diagnostics.
Example fix
// before
export function load({ route }) {
return getData().then((d) => ({ d, routeId: route.id }));
}
// after
export async function load({ route }) {
const routeId = route.id;
const d = await getData();
return { d, routeId };
} Defensive patterns
Strategy: validation
Validate before calling
export async function load({ route }) {
const routeId = route.id; // read synchronously
const data = await getData(routeId);
return { data };
} Prevention
- Read `route.id` before the first `await` in load functions.
- Pass the captured routeId into async helpers instead of the `route` proxy.
- Audit load functions with `.then()` chains for late `route` access.
When it happens
Trigger: Server `load` reads `route.id` (or another `route` property) inside a `.then()`/post-await continuation after the body completed and `uses.route` was never set during tracking.
Common situations: Logging the route id in an async callback; branch-specific logic that reads `route.id` only after data resolves.
Related errors
- ${node.server_id}: Accessing URL properties in a promise han
- ${node.server_id}: Calling `event.fetch(...)` in a promise h
- ${node.server_id}: Calling `depends(...)` in a promise handl
- ${node.server_id}: Accessing `params.${String(key)}` in a pr
- ${node.server_id}: Calling `parent(...)` in a promise handle
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/f1d5fce77bb773d9.
Report an issue: GitHub.