{"record":{"id":"f7efe63cf212bdda","repo":"sveltejs/kit","slug":"relative-does-not-exist","errorCode":null,"errorMessage":"${relative} does not exist","messagePattern":"(.+?) does not exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/config/index.js","lineNumber":81,"sourceCode":"\treturn {\n\t\tsvelte_config,\n\t\tvite_plugin_svelte_config\n\t};\n}\n\n/**\n * Loads the template (src/app.html by default) and validates that it has the\n * required content.\n * @param {string} cwd\n * @param {ValidatedConfig} config\n */\nexport function load_template(cwd, config) {\n\tconst { files } = config;\n\n\tconst relative = path.relative(cwd, files.appTemplate);\n\n\tif (!fs.existsSync(files.appTemplate)) {\n\t\tthrow new Error(`${relative} does not exist`);\n\t}\n\n\tconst contents = fs.readFileSync(files.appTemplate, 'utf8');\n\n\tconst expected_tags = ['%sveltekit.head%', '%sveltekit.body%'];\n\texpected_tags.forEach((tag) => {\n\t\tif (contents.indexOf(tag) === -1) {\n\t\t\tthrow new Error(`${relative} is missing ${tag}`);\n\t\t}\n\t});\n\n\treturn contents;\n}\n\n/**\n * Loads the error page (src/error.html by default) if it exists.\n * Falls back to a generic error page content.\n * @param {ValidatedConfig} config","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/config/index.js#L63-L99","documentation":"SvelteKit requires a app template file (by default src/app.html) that serves as the shell for every rendered page. load_template checks that the file configured at config.kit.files.appTemplate actually exists on disk before reading it; if it does not, it throws. This is a build-time configuration/filesystem sanity check so the dev server or adapter fails fast with a clear message instead of crashing later.","triggerScenarios":"Running `vite dev`, `vite build`, or any path that calls write_server -> load_template when the file at config.kit.files.appTemplate (default src/app.html) is absent: it was deleted, renamed, moved, or kit.files.appTemplate was overridden in svelte.config.js to a path that does not exist.","commonSituations":"Users delete or rename app.html thinking it is optional; monorepo setups where the config points to a wrong relative cwd; scaffolding a project by hand and forgetting app.html; upgrading SvelteKit versions where template defaults changed.","solutions":["Create the missing template file at the configured location, e.g. packages-relative `src/app.html` containing a standard SvelteKit HTML shell.","If the file exists elsewhere, set `kit.files.appTemplate` in svelte.config.js to its correct path.","Verify you are running the build/dev command from the directory (cwd) the config resolves paths against, especially in monorepos."],"exampleFix":"// svelte.config.js — before (path does not exist)\nconst config = { kit: { files: { appTemplate: 'src/template.html' } } };\n// after — either restore src/app.html or point to the real file\nconst config = { kit: { files: { appTemplate: 'src/app.html' } } };","handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nimport path from 'node:path';\nconst appTemplate = path.resolve(process.cwd(), 'src/app.html'); // or your kit.files.appTemplate\nif (!fs.existsSync(appTemplate)) throw new Error(`${path.relative(process.cwd(), appTemplate)} does not exist`);","typeGuard":null,"tryCatchPattern":"try {\n  await viteBuild();\n} catch (e) {\n  if (e.message.endsWith('does not exist') && e.message.includes('app.html')) {\n    console.error('Create src/app.html or fix kit.files.appTemplate in svelte.config.js');\n  }\n  throw e;\n}","preventionTips":["Never delete or rename src/app.html without updating kit.files.appTemplate","Run builds from the project root the config resolves against","Pin the template path in svelte.config.js explicitly in monorepos","Add a CI check that expected source files exist before building"],"tags":["config","filesystem","build-time","missing-file"],"backgroundTag":"missing-required-file","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}