{"record":{"id":"73132f0d11a3f14b","repo":"sveltejs/kit","slug":"unexpected-option-keypath-key-did-you-mean","errorCode":null,"errorMessage":"Unexpected option ${keypath}.${key} (did you mean config.${key}?)","messagePattern":"Unexpected option (.+?)\\.(.+?) \\(did you mean config\\.(.+?)\\?\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/core/config/options.js","lineNumber":393,"sourceCode":"\n\t\tif ((input && typeof input !== 'object') || Array.isArray(input)) {\n\t\t\tthrow new Error(`${keypath} should be an object`);\n\t\t}\n\n\t\tfor (const key in input) {\n\t\t\tif (!(key in children)) {\n\t\t\t\tif (allow_unknown) {\n\t\t\t\t\tconst value = input[key];\n\t\t\t\t\tif (value !== undefined) output[key] = value;\n\t\t\t\t} else {\n\t\t\t\t\tlet message = `Unexpected option ${keypath}.${key}`;\n\n\t\t\t\t\t// special case\n\t\t\t\t\tif (keypath === 'config.kit' && key in kit_options) {\n\t\t\t\t\t\tmessage += ` (did you mean config.${key}?)`;\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow new Error(message);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const key in children) {\n\t\t\tconst validator = children[key];\n\t\t\toutput[key] = validator(input && input[key], `${keypath}.${key}`);\n\t\t}\n\n\t\treturn output;\n\t};\n}\n\n/**\n * @param {any} fallback\n * @param {(value: any, keypath: string) => any} fn\n * @returns {Validator}\n */","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/config/options.js#L375-L411","documentation":"When an unknown key is found inside `config.kit`, SvelteKit checks whether the same key exists at the top level of `config`. If it does, the error message hints that the option belongs in `config.<key>` rather than inside `kit`, and throws to stop the misplacement from being silently ignored.","triggerScenarios":"Putting a root-level option (such as one belonging next to `compilerOptions` or another top-level config field that exists in kit_options' unknown-key check) inside the `kit` object, e.g. kit: { files: ... } when `files` is a top-level key, then validating config.","commonSituations":"Merging configs from older project layouts, confusing root-level options with `kit` options after the pre-1.0 reorganization where many settings moved between the two.","solutions":["Move the key out of `kit` and place it at the top level of the config object as the error suggests.","Consult the current SvelteKit docs to confirm where each option lives.","Remove the key entirely if it is no longer a valid option."],"exampleFix":"// before\nconst config = {\n  kit: { files: { lib: 'src/lib' } }\n};\n// after\nconst config = {\n  files: { lib: 'src/lib' },\n  kit: {}\n};","handlingStrategy":"validation","validationCode":"// fail fast on unknown kit keys before validating\nconst knownKitKeys = new Set(['adapter', 'paths', 'prerender', 'csp', 'alias', 'env', /* ... */]);\nconst unknown = Object.keys(cfg.kit ?? {}).filter((k) => !knownKitKeys.has(k));\nif (unknown.length) console.warn('Unknown kit options (check top-level config):', unknown);","typeGuard":"function isMisplaced(key, cfg) { return key in (cfg.kit ?? {}) && key in cfg; }","tryCatchPattern":"try {\n  build(config);\n} catch (e) {\n  if (String(e.message).includes('did you mean config.')) {\n    const key = /config\\.(\\w+)\\?/.exec(e.message)[1];\n    config[key] = config.kit[key];\n    delete config.kit[key];\n  } else throw e;\n}","preventionTips":["Check current docs for whether an option is root-level or under `kit`.","After pre-1.0 upgrades, diff your config against the official template.","Never guess option placement — search the SvelteKit docs first."],"tags":["sveltekit","config-validation","unknown-option"],"backgroundTag":"misplaced-config-option","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}