{"record":{"id":"ec7f763c0a6742de","repo":"affaan-m/ECC","slug":"option-is-required-exactly-once-for-live-node-q","errorCode":null,"errorMessage":"${option} is required exactly once for live node qualification.","messagePattern":"(.+?) is required exactly once for live node qualification\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/ito.js","lineNumber":97,"sourceCode":"forward ITO_API_KEY directly when configured; ITO_AUTH_MODE=legacy is not\nrequired. The canonical client stores device credentials in macOS Keychain by\ndefault; file-token fallback remains explicit and must use restrictive settings.\nNever put a key or token in arguments, tracked files, or chat.\n\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    );","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/ito.js#L79-L115","documentation":"requiredOptionValue() in ito.js enforces that a given option flag appears exactly once in the argument list for live node qualification. Zero occurrences means a mandatory option is missing; more than one is ambiguous. Both cases throw this error before any process starts.","triggerScenarios":"Calling a live-node-qualification command missing the option (e.g. no --cluster) or repeating it (e.g. --cluster a --cluster b), so indexes.length !== 1 in requiredOptionValue.","commonSituations":"Shell scripts where a variable holding the cluster value is empty, leaving the flag silently dropped; duplicated flags after concatenating argument arrays; users unaware the option is mandatory for --live-sixtytwo runs.","solutions":["Ensure the flagged option (e.g. --cluster <value>) is present exactly once in the command.","In shell wrappers, guard: if [ -z \"$CLUSTER\" ]; then echo \"--cluster required\"; exit 1; fi.","Remove duplicate occurrences of the flag, keeping a single one."],"exampleFix":"// before\nito --live-sixtytwo --nodes node-a\n// after\nito --live-sixtytwo --cluster prod --nodes node-a","handlingStrategy":"validation","validationCode":"const count = args.filter(a => a === option).length; if (count !== 1) throw new Error(`${option} must appear exactly once`);","typeGuard":null,"tryCatchPattern":"try { runQualification(args); } catch (e) { if (e.message.includes('required exactly once')) { console.error(`${e.message} — check your command line`); process.exit(2); } throw e; }","preventionTips":["Build argument arrays programmatically to avoid duplicate/missing flags.","Guard mandatory values in shell before invoking: ${CLUSTER:?--cluster value required}.","Read the qualification docs to know which options are mandatory in live mode."],"tags":["cli","missing-argument","validation"],"backgroundTag":"missing-required-option","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"}