pbakaus/impeccable · error · Error
config.files must contain only non-empty strings
Error message
config.files must contain only non-empty strings
What it means
Thrown by validateConfig() when cfg.files is a non-empty array but at least one element is not a non-empty string (is undefined, null, a number, an empty string, or whitespace). Each file entry must be a real path string; anything else would be silently skipped or mis-handled during injection.
Source
Thrown at skill/scripts/live-inject.mjs:455
} 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'");
}
if (cfg.cspChecked !== undefined && typeof cfg.cspChecked !== 'boolean') {
throw new Error("config.cspChecked, if present, must be a boolean");
}View on GitHub (pinned to d14711ae3d)
Solutions
- Ensure every element of files is a non-empty string path.
- Validate with `jq -e '.files | all(type=="string" and length>0)' config.json`.
- Re-generate the array from a filtered source so empties never land in it.
Example fix
// before
{ "files": ["src/app.tsx", "", null], "insertAfter": "</head>" }
// after
{ "files": ["src/app.tsx"], "insertAfter": "</head>" } Defensive patterns
Strategy: validation
Validate before calling
if (!cfg.files.every(f => typeof f === 'string' && f.length > 0)) {
throw new Error('every entry in config.files must be a non-empty string');
} Type guard
function filesAreNonEmptyStrings(cfg) {
return Array.isArray(cfg.files) && cfg.files.every(f => typeof f === 'string' && f.length > 0);
} Prevention
- Filter empties out of the array before serializing.
- Validate with jq -e '.files | all(type=="string" and length>0)'.
When it happens
Trigger: A files array containing `""`, `null`, a number, or an object; trailing commas producing undefined; a glob that expanded to an empty string.
Common situations: Trailing comma in JSON (invalid, but tools sometimes tolerate it as null); mixing typed values into the array; a template that left an empty slot.
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/43db0c21089a673c.
Report an issue: GitHub.