sveltejs/kit · error · Error
${directory}: `__pathname` is a reserved query parameter for
Error message
${directory}: `__pathname` is a reserved query parameter for `isr.allowQuery` What it means
For ISR routes, adapter-vercel uses the synthetic `__pathname` query parameter internally to map a request URL to its prerendered variant. Users may not reserve it in `isr.allowQuery`, since allowing it would corrupt the cache-key mapping, so the adapter throws during adapt().
Source
Thrown at packages/adapter-vercel/index.js:123
throw new Error('The `edge` runtime is no longer supported');
}
const runtime = resolve_runtime(defaults.runtime, route.config.runtime);
const config = { ...defaults, ...route.config, runtime };
if (is_prerendered(route)) {
if (config.isr) {
ignored_isr.add(route.id);
}
continue;
}
if (config.isr) {
const directory = path.relative('.', builder.config.files.routes + route.id);
if (config.isr.allowQuery?.includes('__pathname')) {
throw new Error(
`${directory}: \`__pathname\` is a reserved query parameter for \`isr.allowQuery\``
);
}
isr_config.set(route, {
expiration: config.isr.expiration,
bypassToken: config.isr.bypassToken,
allowQuery: ['__pathname', ...(config.isr.allowQuery ?? [])],
group: isr_config.size + 1,
passQuery: true
});
}
const hash = hash_config(config);
// first, check there are no routes with incompatible configs that will be merged
const pattern = route.pattern.toString();
const existing = conflicts.get(pattern);View on GitHub (pinned to 03f1687fe6)
Solutions
- Remove '__pathname' from the route's isr.allowQuery array
- List only real user-facing query parameters in allowQuery
- Rebuild after the config change
Example fix
// before
export const config = { isr: { expiration: 60, allowQuery: ['__pathname', 'lang'] } };
// after
export const config = { isr: { expiration: 60, allowQuery: ['lang'] } }; Defensive patterns
Strategy: validation
Validate before calling
const allowQuery = config?.isr?.allowQuery ?? [];
if (allowQuery.includes('__pathname')) {
throw new Error('isr.allowQuery must not include the reserved "__pathname" param');
} Type guard
const reservesPathname = (config) =>
Array.isArray(config?.isr?.allowQuery) && config.isr.allowQuery.includes('__pathname'); Try / catch
try {
await build();
} catch (err) {
if (err.message.includes('__pathname')) {
console.error('Remove __pathname from isr.allowQuery in the named route config.');
}
throw err;
} Prevention
- Treat names starting with __ as framework-reserved
- Only list user-facing params in allowQuery
- Add a code-review checklist item for ISR configs
- Document reserved query params for the team
When it happens
Trigger: A route's config sets `isr: { allowQuery: ['__pathname', ...] }` (or includes '__pathname' anywhere in the allowQuery array).
Common situations: Developer lists every query param the route can receive, inadvertently including __pathname after seeing it in generated Vercel config or URLs; cargo-culting from another project's ISR config.
Related errors
- Invalid isr.expiration value: ${JSON.stringify(value)} (${de
- The `edge` runtime is no longer supported
- The ${route.id} and ${existing.route_id} routes must be merg
- Warning: The following routes have an ISR config which is i
- The _headers file should be placed in the project root rathe
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/cc5f1ba9aefaa8b5.
Report an issue: GitHub.