pbakaus/impeccable · error
Svelte-component source file not found: ${sourceFile}
Error message
Svelte-component source file not found: ${sourceFile} What it means
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.
Source
Thrown at skill/scripts/live/svelte-component.mjs:452
export function readManifest(manifestPath) {
const data = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
return {
...data,
manifestPath,
};
}
export function resolveSourceFile(sourceFile, cwd = process.cwd()) {
if (!sourceFile || path.isAbsolute(sourceFile)) {
throw new Error('Invalid svelte-component source file');
}
const full = path.resolve(cwd, sourceFile);
const rel = path.relative(cwd, full);
if (!rel || rel.startsWith('..') || path.isAbsolute(rel)) {
throw new Error('Svelte-component source file escapes project root');
}
if (!fs.existsSync(full)) {
throw new Error('Svelte-component source file not found: ' + sourceFile);
}
return full;
}
function appendCssToSvelteStyle(lines, cssLines) {
const closeIdx = findLastStyleCloseLine(lines);
const prepared = ['', ...cssLines.map((line) => (line.trim() === '' ? '' : ' ' + line.trimStart()))];
if (closeIdx === -1) {
return [...lines, '', '<style>', ...prepared.slice(1), '</style>'];
}
return [
...lines.slice(0, closeIdx),
...prepared,
...lines.slice(closeIdx),
];
}
function findLastStyleCloseLine(lines) {View on GitHub (pinned to d14711ae3d)
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.
Example fix
// before (file renamed Foo.svelte -> Button.svelte)
resolveSourceFile('src/lib/Foo.svelte', cwd)
// after
resolveSourceFile('src/lib/Button.svelte', cwd) Defensive patterns
Strategy: validation
Validate before calling
const full = path.resolve(cwd, sourceFile);
if (!fs.existsSync(full)) throw new Error('source file not found: ' + sourceFile); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Svelte-component source file not found: ${sourceFile}
- Invalid svelte-component source file
- Svelte-component source file escapes project root
- Invalid svelte-component source file
- Svelte-component source file escapes project root
AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13).
Data as JSON: /api/errors/eceb5dbaef7c7996.
Report an issue: GitHub.