{"record":{"id":"43db0c21089a673c","repo":"pbakaus/impeccable","slug":"config-files-must-contain-only-non-empty-strings-43db0c","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/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/skill/scripts/live-inject.mjs#L437-L473","documentation":"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.","triggerScenarios":"A files array containing `\"\"`, `null`, a number, or an object; trailing commas producing undefined; a glob that expanded to an empty string.","commonSituations":"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.","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."],"exampleFix":"// before\n{ \"files\": [\"src/app.tsx\", \"\", null], \"insertAfter\": \"</head>\" }\n// after\n{ \"files\": [\"src/app.tsx\"], \"insertAfter\": \"</head>\" }","handlingStrategy":"validation","validationCode":"if (!cfg.files.every(f => typeof f === 'string' && f.length > 0)) {\n  throw new Error('every entry in config.files must be a non-empty string');\n}","typeGuard":"function filesAreNonEmptyStrings(cfg) {\n  return Array.isArray(cfg.files) && cfg.files.every(f => typeof f === 'string' && f.length > 0);\n}","tryCatchPattern":null,"preventionTips":["Filter empties out of the array before serializing.","Validate with jq -e '.files | all(type==\"string\" and length>0)'."],"tags":["live-inject","config","validation","json"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}