{"record":{"id":"eceb5dbaef7c7996","repo":"pbakaus/impeccable","slug":"svelte-component-source-file-not-found-sourcefi-eceb5d","errorCode":null,"errorMessage":"Svelte-component source file not found: ${sourceFile}","messagePattern":"Svelte-component source file not found: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"skill/scripts/live/svelte-component.mjs","lineNumber":452,"sourceCode":"export function readManifest(manifestPath) {\n  const data = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));\n  return {\n    ...data,\n    manifestPath,\n  };\n}\n\nexport function resolveSourceFile(sourceFile, cwd = process.cwd()) {\n  if (!sourceFile || path.isAbsolute(sourceFile)) {\n    throw new Error('Invalid svelte-component source file');\n  }\n  const full = path.resolve(cwd, sourceFile);\n  const rel = path.relative(cwd, full);\n  if (!rel || rel.startsWith('..') || path.isAbsolute(rel)) {\n    throw new Error('Svelte-component source file escapes project root');\n  }\n  if (!fs.existsSync(full)) {\n    throw new Error('Svelte-component source file not found: ' + sourceFile);\n  }\n  return full;\n}\n\nfunction appendCssToSvelteStyle(lines, cssLines) {\n  const closeIdx = findLastStyleCloseLine(lines);\n  const prepared = ['', ...cssLines.map((line) => (line.trim() === '' ? '' : '  ' + line.trimStart()))];\n  if (closeIdx === -1) {\n    return [...lines, '', '<style>', ...prepared.slice(1), '</style>'];\n  }\n  return [\n    ...lines.slice(0, closeIdx),\n    ...prepared,\n    ...lines.slice(closeIdx),\n  ];\n}\n\nfunction findLastStyleCloseLine(lines) {","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/skill/scripts/live/svelte-component.mjs#L434-L470","documentation":"Thrown by resolveSourceFile() in live/svelte-component.mjs when the source file passes the sandbox checks (non-empty, relative, inside root) but does not exist on disk (fs.existsSync(full) is false). The message echoes the original sourceFile so the caller sees exactly what was searched. This is the final guard in resolveSourceFile before returning the resolved absolute path.","triggerScenarios":"resolveSourceFile(sourceFile, cwd) is called with a well-formed relative path whose target file is missing — typo in the filename, wrong directory, file deleted/renamed since the config was written, or a casing mismatch on case-sensitive filesystems.","commonSituations":"Component was renamed (PascalCase vs kebab-case) and the config still references the old name; file moved during a refactor; case mismatch on Linux (Foo.svelte vs foo.svelte); a freshly cloned repo is missing a generated component that the build was supposed to produce.","solutions":["Verify the exact filename and casing against the filesystem (ls the directory).","Update the config/argument to the current path after a rename or move.","If the file is generated, run the generator/build step before invoking the adapter."],"exampleFix":"// before (file renamed Foo.svelte -> Button.svelte)\nresolveSourceFile('src/lib/Foo.svelte', cwd)\n// after\nresolveSourceFile('src/lib/Button.svelte', cwd)","handlingStrategy":"validation","validationCode":"const full = path.resolve(cwd, sourceFile);\nif (!fs.existsSync(full)) throw new Error('source file not found: ' + sourceFile);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the generator/build step before invoking the adapter if the component is produced.","Validate casing on case-sensitive filesystems with an exact-name readdir check.","After a rename, grep the config for the old path and update it."],"tags":["svelte","path","filesystem","not-found","live-adapter"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}