{"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":null,"httpStatus":null,"severity":"error","filePath":"scripts/install-guided.js","lineNumber":81,"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":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/install-guided.js#L63-L99","documentation":"install-guided.js requires a value after each of --harness, --claude-scope, --claude-hooks, and --profile. If the next token is missing entirely or itself begins with '--' (i.e. looks like another flag), the parser treats the value as absent and throws. This prevents silently swallowing a flag as a value.","triggerScenarios":"Ending the command with a bare --harness, or writing --harness --yes (the value slot is occupied by another flag), or --claude-scope with nothing after it.","commonSituations":"A wrapper script that appends --harness conditionally but forgets the value, or a user accidentally reordering flags so a value flag is last.","solutions":["Supply a concrete value immediately after the flag, e.g. --harness claude","Do not place another --flag where the value is expected","If the value is optional in your flow, omit the flag entirely instead of leaving it valueless"],"exampleFix":"// before\nnode scripts/install-guided.js --harness --yes\n// after\nnode scripts/install-guided.js --harness claude --yes","handlingStrategy":"validation","validationCode":"const VALUE_FLAGS = new Set(['--harness','--claude-scope','--claude-hooks','--profile']);\nfor (let i = 0; i < argv.length; i++) {\n  if (VALUE_FLAGS.has(argv[i])) {\n    const v = argv[i + 1];\n    if (!v || v.startsWith('--')) throw new Error(`Missing value for ${argv[i]}`);\n  }\n}","typeGuard":"function hasValueForFlag(argv, flag) {\n  const i = argv.indexOf(flag);\n  if (i === -1) return true; // flag absent, nothing to check\n  const v = argv[i + 1];\n  return typeof v === 'string' && v.length > 0 && !v.startsWith('--');\n}","tryCatchPattern":"try { parseInstallGuidedArgs(argv); }\ncatch (err) {\n  if (/^Missing value for/.test(err.message)) {\n    console.error(`${err.message}. Supply a value, e.g. ${/harness/.test(err.message) ? '--harness claude' : '<value>'}.`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Always pair a value flag with its value in wrapper scripts","Never let a value flag be the last token on the command line","Validate generated argv with a pre-check before invoking the installer"],"tags":["cli","argument-validation","install-guided"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}