sveltejs/kit · error · Error
Unexpected option ${keypath}.${key} (did you mean config.${k
Error message
Unexpected option ${keypath}.${key} (did you mean config.${key}?) What it means
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.
Source
Thrown at packages/kit/src/core/config/options.js:393
if ((input && typeof input !== 'object') || Array.isArray(input)) {
throw new Error(`${keypath} should be an object`);
}
for (const key in input) {
if (!(key in children)) {
if (allow_unknown) {
const value = input[key];
if (value !== undefined) output[key] = value;
} else {
let message = `Unexpected option ${keypath}.${key}`;
// special case
if (keypath === 'config.kit' && key in kit_options) {
message += ` (did you mean config.${key}?)`;
}
throw new Error(message);
}
}
}
for (const key in children) {
const validator = children[key];
output[key] = validator(input && input[key], `${keypath}.${key}`);
}
return output;
};
}
/**
* @param {any} fallback
* @param {(value: any, keypath: string) => any} fn
* @returns {Validator}
*/View on GitHub (pinned to 03f1687fe6)
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.
Example fix
// before
const config = {
kit: { files: { lib: 'src/lib' } }
};
// after
const config = {
files: { lib: 'src/lib' },
kit: {}
}; Defensive patterns
Strategy: validation
Validate before calling
// fail fast on unknown kit keys before validating
const knownKitKeys = new Set(['adapter', 'paths', 'prerender', 'csp', 'alias', 'env', /* ... */]);
const unknown = Object.keys(cfg.kit ?? {}).filter((k) => !knownKitKeys.has(k));
if (unknown.length) console.warn('Unknown kit options (check top-level config):', unknown); Type guard
function isMisplaced(key, cfg) { return key in (cfg.kit ?? {}) && key in cfg; } Try / catch
try {
build(config);
} catch (e) {
if (String(e.message).includes('did you mean config.')) {
const key = /config\.(\w+)\?/.exec(e.message)[1];
config[key] = config.kit[key];
delete config.kit[key];
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- ${keypath} must be a valid origin — received '${input}' whic
- Each member of ${keypath} must be either '*' or an absolute
- ${keypath} must be an array of strings, if specified
- ${keypath} should be a number, if specified
- ${keypath} should be true or false, if specified
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/73132f0d11a3f14b.
Report an issue: GitHub.