sveltejs/kit · warning
${node.server_id}: Accessing URL properties in a promise han
Error message
${node.server_id}: Accessing URL properties in a promise handler after `load(...)` has returned will not cause the function to re-run when the URL changes What it means
In server `load` functions, SvelteKit tracks which `url` properties your load function reads to know when to re-run it. If you access `url` inside a promise handler (e.g. inside `.then()` or after an `await`) after `load` has returned, the access happens too late to be tracked, so URL changes will not re-run the load function. This dev-mode warning flags that reactive dependency.
Source
Thrown at packages/kit/src/runtime/server/page/load_data.js:46
parent: false,
route: false,
url: false,
search_params: new Set()
};
const load = node.server.load;
// TODO: shouldn't this be calculated using PageNodes? there could be a trailingSlash option on a layout
const slash = node.server.trailingSlash;
if (!load) {
return { type: 'data', data: null, uses, slash };
}
const url = make_trackable(
event.url,
() => {
if (DEV && done && !uses.url) {
console.warn(
`${node.server_id}: Accessing URL properties in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the URL changes`
);
}
if (is_tracking) {
uses.url = true;
}
},
(param) => {
if (DEV && done && !uses.search_params.has(param)) {
console.warn(
`${node.server_id}: Accessing URL properties in a promise handler after \`load(...)\` has returned will not cause the function to re-run when the URL changes`
);
}
if (is_tracking) {
uses.search_params.add(param);
}View on GitHub (pinned to 03f1687fe6)
Solutions
- Read `url` properties synchronously at the top of `load`, before any `await` or promise continuation.
- Capture needed values into local variables before awaiting, and use those inside the promise handler.
- If the access is intentional one-shot logic, silence by ensuring the value is read before `load` returns.
Example fix
// before
export function load({ url }) {
return fetchSomething().then((data) => ({ data, q: url.searchParams.get('q') }));
}
// after
export async function load({ url }) {
const q = url.searchParams.get('q');
const data = await fetchSomething();
return { data, q };
} Defensive patterns
Strategy: validation
Validate before calling
export async function load({ url }) {
const path = url.pathname;
const q = url.searchParams.get('q');
// use only captured locals after this point
const data = await getData({ path, q });
return { data };
} Prevention
- Read `url` properties before the first `await` in every load function.
- Never reference the `url` object inside `.then()` callbacks.
- Enable dev warnings in CI smoke tests to catch untracked reads early.
When it happens
Trigger: A server `load` returns a promise (or defers work) that later reads `event.url` properties; `done` is true and `uses.url` was never set because earlier reads were not tracked.
Common situations: Awaiting a fetch inside `load` and reading `url.search` or `url.pathname` in the `.then()` callback; capturing `url` in a promise chain resolved after load completes.
Related errors
- ${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
- ${node.server_id}: Accessing `route.${String(key)}` in a pro
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/7b7d1a89ce80f706.
Report an issue: GitHub.