{"record":{"id":"a80044633be33d71","repo":"affaan-m/ECC","slug":"option-requires-a-non-empty-value-for-live-node","errorCode":null,"errorMessage":"${option} requires a non-empty value for live node qualification.","messagePattern":"(.+?) requires a non-empty value for live node qualification\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/ito.js","lineNumber":101,"sourceCode":"\nLive node qualification requires ITO_ENABLE_SIXTYTWO_LIVE=1,\n--live-sixtytwo, an explicit node list, and an existing absolute config\ndirectory. It forwards only named SIXTYTWO_API_TOKEN/SIXTYTWO_TOKEN and SSH\nagent state; ITO_API_KEY is intentionally excluded. The canonical CLI requires\nsixtytwo-cli==0.3.33 and fails closed.\n`);\n}\n\nfunction requiredOptionValue(args, option) {\n  const indexes = args\n    .map((value, index) => (value === option ? index : -1))\n    .filter((index) => index >= 0);\n  if (indexes.length !== 1) {\n    throw new Error(`${option} is required exactly once for live node qualification.`);\n  }\n  const value = args[indexes[0] + 1];\n  if (!value?.trim() || value.startsWith(\"--\")) {\n    throw new Error(`${option} requires a non-empty value for live node qualification.`);\n  }\n  return value;\n}\n\nfunction validateNodeQualificationArgs(args, environment) {\n  if (environment.ITO_ENABLE_SIXTYTWO_LIVE !== \"1\") {\n    throw new Error(\n      \"Live node qualification requires ITO_ENABLE_SIXTYTWO_LIVE=1 before any process is started.\"\n    );\n  }\n  if (args.filter((value) => value === \"--live-sixtytwo\").length !== 1) {\n    throw new Error(\n      \"Live node qualification requires --live-sixtytwo exactly once before any process is started.\"\n    );\n  }\n  requiredOptionValue(args, \"--cluster\");\n  const nodes = requiredOptionValue(args, \"--nodes\");\n  if (!nodes.split(\",\").every((node) => node.trim().length > 0)) {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/ito.js#L83-L119","documentation":"Even when a required option appears exactly once, its value must be non-empty and must not look like another flag. requiredOptionValue rejects a value that is missing, whitespace-only, or begins with '--'. This catches the case where the value slot was accidentally filled by the next flag.","triggerScenarios":"Writing --cluster --nodes n1 (the value of --cluster is the next flag), --cluster '' (empty), or --cluster '   ' (whitespace only).","commonSituations":"Reordering flags so a value flag immediately precedes another flag, an unset shell variable expanding to empty, or a quoting mistake that drops the value.","solutions":["Supply a concrete non-empty value that does not start with '--'","Quote empty-prone shell variables and default them, e.g. ${CLUSTER:?must be set}","Re-run with --help to confirm the expected value shape for each option"],"exampleFix":"// before\n--cluster --nodes n1\n// after\n--cluster my-cluster --nodes n1","handlingStrategy":"validation","validationCode":"function assertOptionHasValue(args, option) {\n  const i = args.indexOf(option);\n  if (i === -1) return;\n  const v = args[i + 1];\n  if (!v || !v.trim() || v.startsWith('--')) {\n    throw new Error(`${option} needs a non-empty value not starting with --`);\n  }\n}\n['--cluster','--nodes','--config-dir'].forEach(opt => assertOptionHasValue(args, opt));","typeGuard":"function optionHasConcreteValue(args, option) {\n  const i = args.indexOf(option);\n  if (i === -1) return true;\n  const v = args[i + 1];\n  return typeof v === 'string' && v.trim().length > 0 && !v.startsWith('--');\n}","tryCatchPattern":"try { validateNodeQualificationArgs(args, env); }\ncatch (err) {\n  if (/requires a non-empty value/.test(err.message)) {\n    console.error(err.message);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Quote shell variables and fail on empty expansion, e.g. ${VAR:?must be set}","Never let a value flag immediately precede another flag","Validate generated argv in wrappers before execution"],"tags":["cli","argument-validation","ito","live-qualification"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}