{"record":{"id":"9438643573db7325","repo":"affaan-m/ECC","slug":"missing-value-for-argument-943864","errorCode":null,"errorMessage":"Missing value for ${argument}","messagePattern":"Missing value for (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/setup.js","lineNumber":84,"sourceCode":"    hooks: undefined,\n    json: false,\n    mode: undefined,\n    moveScope: false,\n    scope: undefined,\n    yes: false,\n  };\n  const valueFlags = new Map([\n    ['--mode', 'mode'],\n    ['--scope', 'scope'],\n    ['--hooks', 'hooks'],\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      options[valueFlags.get(argument)] = value;\n      index += 1;\n    } else if (argument === '--yes' || argument === '-y') {\n      options.yes = true;\n    } else if (argument === '--dry-run') {\n      options.dryRun = true;\n    } else if (argument === '--move-scope') {\n      options.moveScope = true;\n    } else if (argument === '--json') {\n      options.json = true;\n    } else if (argument === '--help' || argument === '-h') {\n      options.help = true;\n    } else {\n      throw new Error(`Unknown argument: ${argument}`);\n    }\n  }\n","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/setup.js#L66-L102","documentation":"parseArgs in scripts/setup.js throws this when a flag that expects a value (--mode, --scope, --hooks) is given without a following value, or the next token looks like another flag (starts with '--'). The parser consumes flags positionally and cannot infer a default, so it aborts setup rather than guessing. This is a CLI usage error surfaced before any installation work begins.","triggerScenarios":"Running the CLI with a dangling value flag: `ecc setup --scope`, `ecc setup --mode --json`, or `ecc setup --hooks` with nothing (or another --flag) after it.","commonSituations":"Typos where the value is omitted; shell history or docs truncated the command; pasting a multi-line command where the value ends up after a line break that the shell collapses; wrapping the value in a variable that expands to empty (e.g. SCOPE=\"\" then --scope $SCOPE unquoted drops the token).","solutions":["Provide the value immediately after the flag, e.g. `ecc setup --mode claude-plugin --scope project`.","Check that a shell variable supplying the value is set and quoted: `--scope \"$SCOPE\"`.","Run `ecc setup --help` to see which flags take values and their expected values."],"exampleFix":"// before\nnpm run setup -- --scope\n\n// after\nnpm run setup -- --scope project","handlingStrategy":"validation","validationCode":"const valueFlags = ['--mode', '--scope', '--hooks'];\nconst i = valueFlags.indexOf(token);\nif (i !== -1) {\n  const next = argv[i + 1];\n  if (!next || next.startsWith('--')) {\n    throw new Error(`Missing value for ${valueFlags[i]}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runSetup(rawArgs);\n} catch (err) {\n  if (/^Missing value for /.test(err.message)) {\n    console.error(err.message + '. Provide a value that does not start with --.');\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Always put the value on the same token position right after the flag.","Quote shell variables that supply values: --scope \"$SCOPE\".","Smoke-test commands with --dry-run before running them in scripts."],"tags":["cli","argument-parsing","setup"],"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"}