{"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":null,"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/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/ito.js#L79-L115","documentation":"ito.js requires that --cluster, --nodes, and --config-dir each appear exactly once for live node qualification. requiredOptionValue counts occurrences and throws if the count is not exactly one (zero or duplicates). This enforces an unambiguous, deliberate configuration for a sensitive live operation.","triggerScenarios":"Omitting --cluster entirely, or passing --cluster twice (e.g. once in a base command and once in an override), or any of the three required options appearing 0 or 2+ times.","commonSituations":"A wrapper script that always adds --cluster colliding with a user-supplied one, or forgetting one of the three required options when assembling the live-qualification command.","solutions":["Provide --cluster, --nodes, and --config-dir each exactly once","Audit your wrapper for duplicate injection of any of these options","Run with --help to confirm the required option set for live qualification"],"exampleFix":"// before\n--live-sixtytwo --nodes n1 --config-dir /cfg\n// after\n--live-sixtytwo --cluster c1 --nodes n1 --config-dir /cfg","handlingStrategy":"validation","validationCode":"function assertOptionExactlyOnce(args, option) {\n  const count = args.filter(a => a === option).length;\n  if (count !== 1) throw new Error(`${option} must appear exactly once (found ${count})`);\n}\n['--cluster','--nodes','--config-dir'].forEach(opt => assertOptionExactlyOnce(args, opt));","typeGuard":"function optionAppearsExactlyOnce(args, option) {\n  return args.filter(a => a === option).length === 1;\n}","tryCatchPattern":"try { validateNodeQualificationArgs(args, env); }\ncatch (err) {\n  if (/is required exactly once/.test(err.message)) {\n    console.error(err.message);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Deduplicate flags when composing the command from multiple sources","Validate exactly-once options in your wrapper before invoking ito","Keep a single canonical live-qualification command in the runbook"],"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"}