{"record":{"id":"43db0c21089a673c","repo":"pbakaus/impeccable","slug":"config-files-must-contain-only-non-empty-strings","errorCode":null,"errorMessage":"config.files must contain only non-empty strings","messagePattern":"config\\.files must contain only non-empty strings","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skill/scripts/live-inject.mjs","lineNumber":455,"sourceCode":"    } else {\n      re += c;\n      i += 1;\n    }\n  }\n  return new RegExp('^' + re + '$');\n}\n\n// ---------------------------------------------------------------------------\n// Core operations\n// ---------------------------------------------------------------------------\n\nfunction validateConfig(cfg) {\n  if (!cfg || typeof cfg !== 'object') throw new Error('config.json must be an object');\n  if (!Array.isArray(cfg.files) || cfg.files.length === 0) {\n    throw new Error('config.files (non-empty string array) required');\n  }\n  if (!cfg.files.every((f) => typeof f === 'string' && f.length > 0)) {\n    throw new Error('config.files must contain only non-empty strings');\n  }\n  if (cfg.exclude !== undefined) {\n    if (!Array.isArray(cfg.exclude)) {\n      throw new Error('config.exclude, if present, must be a string array');\n    }\n    if (!cfg.exclude.every((f) => typeof f === 'string' && f.length > 0)) {\n      throw new Error('config.exclude must contain only non-empty strings');\n    }\n  }\n  if (typeof cfg.insertBefore !== 'string' && typeof cfg.insertAfter !== 'string') {\n    throw new Error('config.insertBefore or config.insertAfter (string) required');\n  }\n  if (cfg.commentSyntax !== 'html' && cfg.commentSyntax !== 'jsx') {\n    throw new Error(\"config.commentSyntax must be 'html' or 'jsx'\");\n  }\n  if (cfg.cspChecked !== undefined && typeof cfg.cspChecked !== 'boolean') {\n    throw new Error(\"config.cspChecked, if present, must be a boolean\");\n  }","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/pbakaus/impeccable/blob/f88b2837a7d7c3182e46307bbbb091a1ed547571/skill/scripts/live-inject.mjs#L437-L473","documentation":"Third check in validateConfig(): every element of cfg.files must be a non-empty string. An array that exists and is non-empty but contains '' (or a non-string) fails here. Empty entries usually come from programmatic generation of the list rather than hand authoring.","triggerScenarios":"files: [\"index.html\", \"\"] — a trailing empty element from splitting a newline-joined list, a glob placeholder that expanded to nothing, or an undefined value serialized by JSON.stringify (which becomes null, also not a string).","commonSituations":"Scripts building the list via lines.split('\\n') without filtering empties; agents copying a template with an unfilled placeholder; JSON written with a null entry where a path was intended.","solutions":["Remove empty/null entries from the files array so every item is a non-empty string path or glob","If the list is generated, filter it: paths.filter((p) => typeof p === 'string' && p.trim())","Re-run with `--check` to confirm the cleaned array"],"exampleFix":"// before\n\"files\": [\"index.html\", \"\"]\n\n// after\n\"files\": [\"index.html\"]","handlingStrategy":"validation","validationCode":"const ok = Array.isArray(cfg.files)\n  && cfg.files.length > 0\n  && cfg.files.every((f) => typeof f === 'string' && f.length > 0);\nif (!ok) throw new TypeError('config.files entries must be non-empty strings');","typeGuard":"const hasCleanFileEntries = (cfg) =>\n  Array.isArray(cfg.files) && cfg.files.every((f) => typeof f === 'string' && f.trim() !== '');","tryCatchPattern":null,"preventionTips":["Filter generated lists before writing: paths.filter((p) => typeof p === 'string' && p.trim())","Never split a newline-joined list into an array without removing empties","JSON.stringify drops undefined but keeps null — map missing entries explicitly instead of leaving holes"],"tags":["config","schema","files","live-inject"],"backgroundTag":"config-schema-validation","analyzedSha":"f88b2837a7d7c3182e46307bbbb091a1ed547571","analyzedAt":"2026-08-18T04:58:36.608Z","contentChangedAt":"2026-08-18T04:58:36.608Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}