{"record":{"id":"1d857b33eb2c8c2c","repo":"sveltejs/kit","slug":"mismatched-route-config-for-route-id-the-pag","errorCode":null,"errorMessage":"Mismatched route config for ${route.id} — the +page and +server files must export the same config, if any","messagePattern":"Mismatched route config for (.+?) — the \\+page and \\+server files must export the same config, if any","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/postbuild/analyse.js","lineNumber":108,"sourceCode":"\t// analyse routes\n\tfor (const route of manifest.routes) {\n\t\tconst page =\n\t\t\troute.page &&\n\t\t\tanalyse_page(\n\t\t\t\troute.page.layouts.map((n) => (n === undefined ? n : nodes[n])),\n\t\t\t\tnodes[route.page.leaf]\n\t\t\t);\n\n\t\tconst endpoint = route.endpoint && analyse_endpoint(route, await route.endpoint());\n\n\t\tif (page?.prerender && endpoint?.prerender) {\n\t\t\tthrow new Error(`Cannot prerender a route with both +page and +server files (${route.id})`);\n\t\t}\n\n\t\tif (page?.config && endpoint?.config) {\n\t\t\tfor (const key in { ...page.config, ...endpoint.config }) {\n\t\t\t\tif (JSON.stringify(page.config[key]) !== JSON.stringify(endpoint.config[key])) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Mismatched route config for ${route.id} — the +page and +server files must export the same config, if any`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst route_config = page?.config ?? endpoint?.config ?? {};\n\t\tconst prerender = page?.prerender ?? endpoint?.prerender;\n\n\t\tif (prerender !== true) {\n\t\t\tfor (const feature of list_features(\n\t\t\t\troute,\n\t\t\t\tmanifest_data,\n\t\t\t\tserver_manifest,\n\t\t\t\ttracked_features\n\t\t\t)) {\n\t\t\t\tcheck_feature(route.id, route_config, feature, config.adapter);\n\t\t\t}","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/postbuild/analyse.js#L90-L126","documentation":"When a route has both +page and +server files, SvelteKit requires any page-level `export const config` and endpoint-level `export const config` to match exactly. JSON-unequal configs for the same key cause this error, because one route cannot carry two different configurations.","triggerScenarios":"A route directory with +page.js exporting `config = { runtime: 'edge' }` and +server.js exporting a different `config` (different values, or one side missing a key the other has, when both define config).","commonSituations":"Adapter-specific configs (e.g. Cloudflare/Vercel runtime) diverging between +page and +server during iterative edits; one teammate updating page config but not the server config.","solutions":["Make the `config` exports in +page.js and +server.js identical (deep-equal) for that route.","Or remove `config` from one of the files if it's only meaningful for one side's deployment.","If the page and endpoint truly need different configs, split them into different route directories."],"exampleFix":"// before (+server.js)\nexport const config = { runtime: 'experimental_node' };\n// after (match +page.js)\nexport const config = { runtime: 'nodejs20' };","handlingStrategy":"validation","validationCode":"const pageConfig = (await import('./src/routes/demo/+page.js')).config;\nconst serverConfig = (await import('./src/routes/demo/+server.js')).config;\nif (pageConfig && serverConfig &&\n    JSON.stringify(pageConfig) !== JSON.stringify(serverConfig)) {\n  throw new Error('+page and +server config exports must be identical');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await build();\n} catch (e) {\n  if (String(e.message).includes('Mismatched route config')) {\n    console.error('Sync the `config` exports between +page.js and +server.js in:', e.message);\n  } else throw e;\n}","preventionTips":["Keep a single shared constant (e.g. export const config from a common module) imported by both files.","After editing adapter-specific config, update both +page and +server in mixed routes.","Review git diffs of one side for a route directory to catch the other side needing the same change."],"tags":["routing","config","build"],"backgroundTag":"conflicting-route-config","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}