{"record":{"id":"f5e62c52eca8764f","repo":"sveltejs/kit","slug":"node-server-id-accessing-params-string-key","errorCode":null,"errorMessage":"${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","messagePattern":"(.+?): Accessing `params\\.(.+?)` in a promise handler after `load\\(\\.\\.\\.\\)` has returned will not cause the function to re-run when the param changes","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/runtime/server/page/load_data.js","lineNumber":120,"sourceCode":"\t\t\t\t\t\t\tconst { href } = new URL(dep, event.url);\n\n\t\t\t\t\t\t\tif (DEV) {\n\t\t\t\t\t\t\t\tvalidate_depends(node.server_id || 'missing route ID', dep);\n\n\t\t\t\t\t\t\t\tif (done && !uses.dependencies.has(href)) {\n\t\t\t\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\t\t\t`${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`\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tuses.dependencies.add(href);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tparams: new Proxy(event.params, {\n\t\t\t\t\t\tget: (target, key) => {\n\t\t\t\t\t\t\tif (DEV && done && typeof key === 'string' && !uses.params.has(key)) {\n\t\t\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\t\t`${node.server_id}: Accessing \\`params.${String(\n\t\t\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t\t\t)}\\` in a promise handler after \\`load(...)\\` has returned will not cause the function to re-run when the param changes`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (is_tracking) {\n\t\t\t\t\t\t\t\tuses.params.add(key);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn target[/** @type {string} */ (key)];\n\t\t\t\t\t\t}\n\t\t\t\t\t}),\n\t\t\t\t\tparent: async () => {\n\t\t\t\t\t\tif (DEV && done && !uses.parent) {\n\t\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t\t`${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`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/server/page/load_data.js#L102-L138","documentation":"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.","triggerScenarios":"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.","commonSituations":"Using `params.id` inside a fetch callback or `then` after awaiting; destructuring params lazily in async helpers invoked from a promise chain.","solutions":["Read all needed `params` keys synchronously at the top of `load`, before any `await`.","Copy param values into local constants and pass those into async continuations.","Destructure `const { id, slug } = params` immediately in the load body."],"exampleFix":"// before\nexport function load({ params }) {\n  return getData().then((d) => ({ d, id: params.id }));\n}\n// after\nexport async function load({ params }) {\n  const { id } = params;\n  const d = await getData();\n  return { d, id };\n}","handlingStrategy":"validation","validationCode":"export async function load({ params }) {\n  const { id, slug } = params; // destructure immediately so reads are tracked\n  const data = await getData(id, slug);\n  return { data };\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Destructure `params` on the first line of every load function.","Never access `params` inside `.then()` or post-await continuations.","Add a code-review checklist item for params usage in async load code."],"tags":["load-function","params","sveltekit","server"],"backgroundTag":"load-untracked-params-access","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}