{"record":{"id":"6e7efe234df6bf5b","repo":"pbakaus/impeccable","slug":"config-exclude-must-contain-only-non-empty-strings-6e7efe","errorCode":null,"errorMessage":"config.exclude must contain only non-empty strings","messagePattern":"config\\.exclude must contain only non-empty strings","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skill/scripts/live-inject.mjs","lineNumber":462,"sourceCode":"\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  }\n}\n\n// ---------------------------------------------------------------------------\n// Auto-execute\n// ---------------------------------------------------------------------------\n\nconst _running = process.argv[1];","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/skill/scripts/live-inject.mjs#L444-L480","documentation":"Thrown by validateConfig() in live-inject.mjs when cfg.exclude is an array but at least one element is not a non-empty string. The check is cfg.exclude.every(f => typeof f === 'string' && f.length > 0), so empty strings, numbers, nulls, or booleans inside the array are rejected. Like the other validateConfig guards it fires before any file writes so the working tree stays clean.","triggerScenarios":"validateConfig runs on a config whose 'exclude' array contains an empty string (trailing comma in JSON-like edits), a number (e.g. a port sneaked in), null, or undefined slot. Example: \"exclude\": [\"*.test.js\", \"\", \"*.spec.js\"].","commonSituations":"Trailing comma produced an empty element during hand-editing; a script builds the array with a buggy push that appends undefined then JSON.stringify drops it to null; copy-paste left a blank line that became an empty string; mixing glob objects {glob:...} instead of bare strings.","solutions":["Remove empty or non-string entries from 'exclude'; every element must be a non-empty string glob.","If a glob was supplied as an object, unwrap it to a plain string.","Re-run the injector after fixing; no files are modified on a failed validation."],"exampleFix":"// before\n\"exclude\": [\"**/*.test.html\", \"\", null, \"**/fixtures/**\"]\n// after\n\"exclude\": [\"**/*.test.html\", \"**/fixtures/**\"]","handlingStrategy":"validation","validationCode":"const exclude = (cfg.exclude || []).filter((x) => typeof x === 'string' && x.length > 0);\nif ((cfg.exclude || []).length !== exclude.length) {\n  throw new Error('cfg.exclude contained empty/non-string entries');\n}","typeGuard":"function isNonEmptyStringArray(v): v is string[] {\n  return Array.isArray(v) && v.length > 0 && v.every((x) => typeof x === 'string' && x.length > 0);\n}","tryCatchPattern":null,"preventionTips":["Avoid trailing commas and blank lines when hand-editing JSON.","When constructing exclude from dynamic data, filter falsy/empty values before assigning.","Lint config.json with a schema validator in pre-commit."],"tags":["config","validation","live-inject","json"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}