{"record":{"id":"5103ccbdd4929864","repo":"affaan-m/ECC","slug":"missing-value-for-argument","errorCode":null,"errorMessage":"Missing value for ${argument}","messagePattern":"Missing value for (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/install-guided.js","lineNumber":82,"sourceCode":"    harnesses: [],\n    help: false,\n    json: false,\n    profile: undefined,\n    yes: false,\n  };\n  const valueFlags = new Map([\n    ['--harness', 'harnesses'],\n    ['--claude-scope', 'claudeScope'],\n    ['--claude-hooks', 'claudeHooks'],\n    ['--profile', 'profile'],\n  ]);\n\n  for (let index = 0; index < argv.length; index += 1) {\n    const argument = argv[index];\n    if (valueFlags.has(argument)) {\n      const value = argv[index + 1];\n      if (!value || value.startsWith('--')) {\n        throw new Error(`Missing value for ${argument}`);\n      }\n      if (value.length > 256) {\n        throw new Error(`Value for ${argument} is too long.`);\n      }\n      const key = valueFlags.get(argument);\n      options = key === 'harnesses'\n        ? { ...options, harnesses: [...options.harnesses, value] }\n        : { ...options, [key]: value };\n      index += 1;\n    } else if (argument === '--all-harnesses') {\n      options = { ...options, allHarnesses: true };\n    } else if (argument === '--yes' || argument === '-y') {\n      options = { ...options, yes: true };\n    } else if (argument === '--dry-run') {\n      options = { ...options, dryRun: true };\n    } else if (argument === '--json') {\n      options = { ...options, json: true };\n    } else if (argument === '--help' || argument === '-h') {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/install-guided.js#L64-L100","documentation":"parseArgs in scripts/install-guided.js throws this when a value-taking flag (--harness, --root, etc.) is given without a following value, or the next token is itself another flag. It ensures every value flag is paired with a concrete operand.","triggerScenarios":"Running `node scripts/install-guided.js --harness` (nothing after), or `--harness --json` where the next token starts with `--`, or the flag is the last argv element.","commonSituations":"Truncated commands in CI logs, shell variable expanding to empty (`--harness $H` with H unset), pasting a command and dropping the value, flag ordering mistakes.","solutions":["Provide the value directly after the flag: `--harness claude`","Check for empty shell variables and quote/validate them before invoking","Reorder flags so a value flag is never last or followed by another flag","Run with --help to see which flags require values"],"exampleFix":"// before\nnode scripts/install-guided.js --harness --json\n// after\nnode scripts/install-guided.js --harness claude --json","handlingStrategy":"validation","validationCode":"const VALUE_FLAGS = ['--harness', '--root', '--format'];\nfor (let i = 0; i < argv.length; i++) {\n  if (VALUE_FLAGS.includes(argv[i]) && (!argv[i + 1] || argv[i + 1].startsWith('--'))) {\n    throw new Error(`Missing value for ${argv[i]}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  parseArgs(rawArgv);\n} catch (err) {\n  if (err.message.startsWith('Missing value for')) {\n    console.error(`${err.message} — usage: <flag> <value>`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Quote and default shell variables: `--harness \"${HARNESS:-claude}\"`","Check CI command logs for truncated lines","Run --help to confirm which flags take values"],"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"}