{"record":{"id":"985cb50445ce1772","repo":"sveltejs/kit","slug":"keypath-should-be-fail-warn-ignore-or-a","errorCode":null,"errorMessage":"${keypath} should be \"fail\", \"warn\", \"ignore\" or a custom function","messagePattern":"(.+?) should be \"fail\", \"warn\", \"ignore\" or a custom function","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/config/options.js","lineNumber":42,"sourceCode":"\tsandbox: string_array(),\n\t'form-action': string_array(),\n\t'frame-ancestors': string_array(),\n\t'navigate-to': string_array(),\n\t'report-uri': string_array(),\n\t'report-to': string_array(),\n\t'require-trusted-types-for': string_array(),\n\t'trusted-types': string_array(),\n\t'upgrade-insecure-requests': boolean(false),\n\t'require-sri-for': string_array(),\n\t'block-all-mixed-content': boolean(false),\n\t'plugin-types': string_array(),\n\treferrer: string_array()\n});\n\nconst prerender_handler = validate(undefined, (input, keypath) => {\n\tif (typeof input === 'function') return input;\n\tif (['fail', 'warn', 'ignore'].includes(input)) return input;\n\tthrow new Error(`${keypath} should be \"fail\", \"warn\", \"ignore\" or a custom function`);\n});\n\nconst options = {\n\tadapter: validate(undefined, (input, keypath) => {\n\t\tif (typeof input !== 'object' || !input.adapt) {\n\t\t\tconst message = `The SvelteKit Vite plugin ${keypath} should be an object with an \\`adapt\\` method`;\n\t\t\tthrow new Error(`${message}. See https://svelte.dev/docs/kit/adapters`);\n\t\t}\n\n\t\treturn input;\n\t}),\n\n\talias: deprecate(\n\t\tvalidate({}, (input, keypath) => {\n\t\t\tif (typeof input !== 'object') {\n\t\t\t\tthrow new Error(`${keypath} should be an object`);\n\t\t\t}\n","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/config/options.js#L24-L60","documentation":"The `prerender.handle` option must be either the string 'fail', 'warn', 'ignore', or a custom function `(entry) => ...`. The options validator (prerender_handler) throws when the provided value is none of these — typically a typo'd string, a wrong type, or a function placed in the wrong nesting level.","triggerScenarios":"validate_options walks config.kit.prerender and calls prerender_handler with an input that is not a function and not one of the literals 'fail', 'warn', 'ignore' (e.g. 'error', true, null when explicitly set, or a number).","commonSituations":"Typo like `handle: 'throw'` or `handle: 'log'`; copying a config where the option was renamed; passing an async wrapper incorrectly or setting the key at `kit` level instead of `kit.prerender`.","solutions":["Set `kit.prerender.handle` to exactly 'fail', 'warn', or 'ignore'.","If custom behavior is needed, pass a function: `handle: (entry) => { ... }`.","Confirm the option is nested under `kit.prerender`, not `kit` directly."],"exampleFix":"// before\nkit: { prerender: { handle: 'throw' } }\n// after\nkit: { prerender: { handle: 'fail' } }","handlingStrategy":"validation","validationCode":"const handle = config.kit?.prerender?.handle;\nif (handle !== undefined && typeof handle !== 'function' && !['fail', 'warn', 'ignore'].includes(handle)) {\n  throw new Error('kit.prerender.handle must be \"fail\", \"warn\", \"ignore\" or a function');\n}","typeGuard":"/** @returns {boolean} */\nfunction isValidPrerenderHandle(v) {\n  return typeof v === 'function' || ['fail', 'warn', 'ignore'].includes(v);\n}","tryCatchPattern":"try {\n  await viteBuild();\n} catch (e) {\n  if (e.message.includes('should be \"fail\", \"warn\", \"ignore\" or a custom function')) {\n    console.error('Fix kit.prerender.handle to a valid literal or function');\n  }\n  throw e;\n}","preventionTips":["Copy prerender.handle values only from the docs","Use a TypeScript/JSDoc union type: `'fail' | 'warn' | 'ignore' | ((entry) => ...)`","Nest the option under kit.prerender, not kit directly","Let the config validator catch typos before committing"],"tags":["config","validation","prerender","enum-value"],"backgroundTag":"invalid-enum-config-value","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}