pbakaus/impeccable · error · Error
config.files (non-empty string array) required
Error message
config.files (non-empty string array) required
What it means
Thrown by validateConfig() when cfg.files is missing, not an array, or an empty array. The files array is the set of source files live-inject will modify, so it is mandatory and non-empty — without it there is nothing to inject into.
Source
Thrown at skill/scripts/live-inject.mjs:452
} else if (/[.+^${}()|[\]\\]/.test(c)) {
re += '\\' + c;
i += 1;
} else {
re += c;
i += 1;
}
}
return new RegExp('^' + re + '$');
}
// ---------------------------------------------------------------------------
// Core operations
// ---------------------------------------------------------------------------
function validateConfig(cfg) {
if (!cfg || typeof cfg !== 'object') throw new Error('config.json must be an object');
if (!Array.isArray(cfg.files) || cfg.files.length === 0) {
throw new Error('config.files (non-empty string array) required');
}
if (!cfg.files.every((f) => typeof f === 'string' && f.length > 0)) {
throw new Error('config.files must contain only non-empty strings');
}
if (cfg.exclude !== undefined) {
if (!Array.isArray(cfg.exclude)) {
throw new Error('config.exclude, if present, must be a string array');
}
if (!cfg.exclude.every((f) => typeof f === 'string' && f.length > 0)) {
throw new Error('config.exclude must contain only non-empty strings');
}
}
if (typeof cfg.insertBefore !== 'string' && typeof cfg.insertAfter !== 'string') {
throw new Error('config.insertBefore or config.insertAfter (string) required');
}
if (cfg.commentSyntax !== 'html' && cfg.commentSyntax !== 'jsx') {
throw new Error("config.commentSyntax must be 'html' or 'jsx'");
}View on GitHub (pinned to d14711ae3d)
Solutions
- Add a non-empty `files` array of source paths, e.g. "files": ["src/app.tsx", "src/pages/*.astro"].
- Confirm each entry is a non-empty string (a follow-up check enforces this).
- Verify the glob/path actually resolves to at least one file before writing it into config.
Example fix
// before
{ "insertAfter": "</head>" }
// after
{ "files": ["src/app.tsx"], "insertAfter": "</head>" } Defensive patterns
Strategy: validation
Validate before calling
if (!Array.isArray(cfg.files) || cfg.files.length === 0) {
throw new Error('config.files must be a non-empty string array');
} Type guard
function hasNonEmptyFiles(cfg) {
return Array.isArray(cfg.files) && cfg.files.length > 0;
} Prevention
- Always include a non-empty files array in live-inject config.
- Confirm the glob resolves to at least one file before writing config.
When it happens
Trigger: A config.json with no `files` key, with `files: {}`, or with `files: []`. Also a programmatic cfg object omitting the field.
Common situations: Skeleton config copied without filling in files; a glob expansion that produced zero matches being written verbatim; renaming the key (e.g. to `targets`).
Related errors
- config.json must be an object
- config.files (non-empty string array) required
- config.files must contain only non-empty strings
- config.exclude, if present, must be a string array
- config.exclude must contain only non-empty strings
AI-assisted analysis of pbakaus/impeccable@d14711ae3d (2026-08-13).
Data as JSON: /api/errors/66fe8f5d11265ea6.
Report an issue: GitHub.