{"record":{"id":"629d2bc5a4702640","repo":"sveltejs/kit","slug":"description-did-you-mean-corrected-at-pa","errorCode":null,"errorMessage":"${description}. Did you mean ${corrected}? at ${path.resolve(misspelled)}","messagePattern":"(.+?)\\. Did you mean (.+?)\\? at (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/kit/src/core/sync/utils.js","lineNumber":84,"sourceCode":"\t}\n\n\tstr = str.trim();\n\n\treturn str;\n}\n\n/**\n * @param {string} original\n * @param {string} typo The common misspelling to check for\n * @param {string} description What was wrong with the filename\n */\nexport function check_spelling(original, typo, description) {\n\tconst misspelled = resolve_entry(typo);\n\tif (!misspelled) return;\n\n\tconst corrected = path.basename(misspelled).replace(path.basename(typo), path.basename(original));\n\n\tconsole.warn(\n\t\tstyleText(\n\t\t\t['bold', 'yellow'],\n\t\t\t`${description}. Did you mean ${corrected}?` + ` at ${path.resolve(misspelled)}`\n\t\t)\n\t);\n}\n","sourceCodeStart":66,"sourceCodeEnd":91,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/core/sync/utils.js#L66-L91","documentation":"`check_spelling` in sync/utils.js detects that a user-referenced entry file (e.g. `src/hooks.server.js` vs `.ts`) appears to be a misspelling of a file that actually exists, and warns with the corrected filename and its resolved absolute path. Sync proceeds but the intended file may not be picked up.","triggerScenarios":"svelte.config.js or generated references point at e.g. `src/hooks.server.ts` while only `src/hooks.server.js` exists (or vice versa), or similarly mismatched `+layout.server` / client hook filenames.","commonSituations":"Renaming a file between .js and .ts during a TypeScript migration; template docs referencing the other extension; files added to the wrong directory.","solutions":["Rename the file to the corrected basename shown in the warning (`git mv <misspelled> <corrected>`)","Update the reference (config option or import) to point at the actual file extension","Remove a stale duplicate file if both variants exist"],"exampleFix":"// before: config points to src/hooks.server.ts, but file is src/hooks.server.js\n// after\ngit mv src/hooks.server.js src/hooks.server.ts\n// or update the reference to 'src/hooks.server.js'","handlingStrategy":"validation","validationCode":"// check referenced hook files exist before build\nimport { existsSync } from 'node:fs';\nfor (const f of ['src/hooks.server.ts', 'src/hooks.server.js', 'src/hooks.client.ts']) {\n  console.log(f, existsSync(f));\n}","typeGuard":"const isValidEntry = (p) => typeof p === 'string' && existsSync(resolve(p));","tryCatchPattern":null,"preventionTips":["Use `git mv` so JS/TS extension renames stay consistent in imports and configs","Stick to one language extension per project for hook files","Run `svelte-kit sync` in CI to surface spelling warnings early"],"tags":["sync","file-naming","typo"],"backgroundTag":"filename-misspelling-hint","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}