{"record":{"id":"b56f5263594d42da","repo":"sveltejs/kit","slug":"cannot-use-server-only-files-in-an-app-with-route","errorCode":null,"errorMessage":"Cannot use server-only files in an app with `router.type === 'hash': ${project_relative}","messagePattern":"Cannot use server-only files in an app with `router\\.type === 'hash': (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/sync/create_manifest_data/index.js","lineNumber":286,"sourceCode":"\t\t\t\tif (file.name.endsWith('.d.ts')) {\n\t\t\t\t\tlet name = file.name.slice(0, -5);\n\t\t\t\t\tconst ext = valid_extensions.find((ext) => name.endsWith(ext));\n\t\t\t\t\tif (ext) name = name.slice(0, -ext.length);\n\n\t\t\t\t\tif (component_name_pattern.test(name) || module_name_pattern.test(name)) continue;\n\t\t\t\t}\n\n\t\t\t\tconst project_relative = posixify(path.relative(cwd, path.join(dir, file.name)));\n\n\t\t\t\tconst item = analyze(\n\t\t\t\t\tproject_relative,\n\t\t\t\t\tfile.name,\n\t\t\t\t\tconfig.extensions,\n\t\t\t\t\tconfig.moduleExtensions\n\t\t\t\t);\n\n\t\t\t\tif (config.router.type === 'hash' && item.kind === 'server') {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Cannot use server-only files in an app with \\`router.type === 'hash': ${project_relative}`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * @param {string} type\n\t\t\t\t * @param {string} existing_file\n\t\t\t\t */\n\t\t\t\tfunction duplicate_files_error(type, existing_file) {\n\t\t\t\t\treturn new Error(\n\t\t\t\t\t\t`Multiple ${type} files found in ${routes_base}${route.id} : ${path.basename(\n\t\t\t\t\t\t\texisting_file\n\t\t\t\t\t\t)} and ${file.name}`\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tif (item.kind === 'component') {\n\t\t\t\t\tif (item.is_error) {","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/sync/create_manifest_data/index.js#L268-L304","documentation":"Route-tree validation error thrown while walking src/routes: with config.router.type === 'hash', routing happens client-side and every route must be loadable in the browser, so server-only files (e.g. +page.server.js, +server.js, .server.js modules) are not allowed. The error names the offending project-relative file. Fires during manifest generation.","triggerScenarios":"Thrown at packages/kit/src/core/sync/create_manifest_data/index.js:286 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove or rename the server-only file (drop the .server suffix, or delete +server.js/+page.server.js)","Switch the router type back to 'pathname' if server routes are required"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}