{"record":{"id":"8d1ff66d0716854a","repo":"affaan-m/ECC","slug":"missing-value-for-family","errorCode":null,"errorMessage":"Missing value for --family","messagePattern":"Missing value for --family","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/catalog.js","lineNumber":79,"sourceCode":"  };\n\n  if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {\n    parsed.help = true;\n    return parsed;\n  }\n\n  parsed.command = args[0];\n\n  for (let index = 1; index < args.length; index += 1) {\n    const arg = args[index];\n\n    if (arg === '--help' || arg === '-h') {\n      parsed.help = true;\n    } else if (arg === '--json') {\n      parsed.json = true;\n    } else if (arg === '--family') {\n      if (!args[index + 1]) {\n        throw new Error('Missing value for --family');\n      }\n      parsed.family = normalizeFamily(args[index + 1]);\n      index += 1;\n    } else if (arg === '--target') {\n      if (!args[index + 1]) {\n        throw new Error('Missing value for --target');\n      }\n      parsed.target = args[index + 1];\n      index += 1;\n    } else if (parsed.command === 'show' && !parsed.componentId) {\n      parsed.componentId = arg;\n    } else {\n      throw new Error(`Unknown argument: ${arg}`);\n    }\n  }\n\n  return parsed;\n}","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/catalog.js#L61-L97","documentation":"The parseArgs function in scripts/catalog.js validates CLI flags. --family requires a following value that gets passed through normalizeFamily; when the flag is the last argument or is immediately followed by an empty token, no value exists and the parser throws 'Missing value for --family'.","triggerScenarios":"Running e.g. `node scripts/catalog.js list --family` with nothing after it; also `--family $FAMILY` with FAMILY unset (empty expansion) making args[index+1] falsy.","commonSituations":"Copy-pasting a command and truncating the value; shell splitting/interpolation dropping the value; forgetting that --family takes a value and treating it as boolean.","solutions":["Append the family value after --family: `catalog list --family skill`","Quote values containing spaces or special shell characters","Guard env interpolation so empty values fail early (e.g. ${FAMILY:?FAMILY required})","Run `catalog --help` to see accepted --family values"],"exampleFix":"// before (FAMILY unset)\nnode scripts/catalog.js list --family $FAMILY\n// after\nnode scripts/catalog.js list --family skill","handlingStrategy":"validation","validationCode":"const idx = process.argv.indexOf('--family');\nif (idx !== -1 && (idx + 1 >= process.argv.length || !process.argv[idx + 1])) {\n  console.error('--family requires a value');\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const options = parseArgs(process.argv.slice(2));\n} catch (err) {\n  if (/Missing value for --/.test(err.message)) {\n    console.error(`${err.message}\\nUsage: catalog list --family <family>`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Always provide --family with an explicit value in scripts","Quote values containing spaces","Validate CLI arrays before invoking the script from automation","Reference --help output when composing commands"],"tags":["cli","argument-parsing","missing-value"],"backgroundTag":"missing-cli-argument","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}