{"record":{"id":"ae277e0440860da2","repo":"pbakaus/impeccable","slug":"config-exclude-must-contain-only-non-empty-strings","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":"warning","filePath":"plugin/skills/impeccable/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/plugin/skills/impeccable/scripts/live-inject.mjs#L444-L480","documentation":"Fifth validateConfig() check: when cfg.exclude is an array, every element must be a non-empty string. Mirrors the files check (error 48) but for the optional exclude list. globToRegex() compiles each entry into a RegExp, so a non-string would throw inside the regex builder with a less helpful message.","triggerScenarios":"[\"node_modules\\/**\", 0], [\"\"], [\"dist\\/**\", null]. Same typed-wrong shape as error 48 but on the exclude field.","commonSituations":"Programmatic exclude build pushed a non-string; placeholder '' left during editing; boolean toggles mis-serialised into the array.","solutions":["Ensure every exclude entry is a non-empty glob string.","Filter: exclude.filter((e) => typeof e === 'string' && e.trim()).","Run `node live-inject.mjs --check` to find the offending entry.","Regenerate config via setup if hand-editing is error-prone."],"exampleFix":"// before\n{ \"exclude\": [\"dist\\/**\", false], ... }\n\n// after\n{ \"exclude\": [\"dist\\/**\"], ... }","handlingStrategy":"validation","validationCode":"function areExcludeEntriesValid(cfg) {\n  return cfg?.exclude === undefined\n    || (Array.isArray(cfg.exclude)\n      && cfg.exclude.every((f) => typeof f === 'string' && f.length > 0));\n}\nif (!areExcludeEntriesValid(cfg)) {\n  cfg.exclude = cfg.exclude.filter((f) => typeof f === 'string' && f);\n}","typeGuard":"function isNonEmptyStringArrayOrNull(value) {\n  return value === undefined || isNonEmptyStringArray(value);\n}","tryCatchPattern":"try {\n  validateConfig(cfg);\n} catch (err) {\n  if (/config\\.exclude must contain only non-empty strings/.test(err.message)) {\n    cfg.exclude = cfg.exclude.filter((f) => typeof f === 'string' && f);\n    validateConfig(cfg);\n  }\n  throw err;\n}","preventionTips":["Filter exclude entries the same way as files: only non-empty strings.","Don't push booleans/numbers toggles into the exclude array.","Run `node live-inject.mjs --check` to locate a bad entry."],"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"}