affaan-m/ECC · error · Error

Missing value for

Error message

Missing value for ${argument}

What it means

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.

Solutions

  1. Provide the value directly after the flag: `--harness claude`
  2. Check for empty shell variables and quote/validate them before invoking
  3. Reorder flags so a value flag is never last or followed by another flag
  4. Run with --help to see which flags require values

Example fix

// before
node scripts/install-guided.js --harness --json
// after
node scripts/install-guided.js --harness claude --json
Defensive patterns

Strategy: validation

Validate before calling

const VALUE_FLAGS = ['--harness', '--root', '--format'];
for (let i = 0; i < argv.length; i++) {
  if (VALUE_FLAGS.includes(argv[i]) && (!argv[i + 1] || argv[i + 1].startsWith('--'))) {
    throw new Error(`Missing value for ${argv[i]}`);
  }
}

Try / catch

try {
  parseArgs(rawArgv);
} catch (err) {
  if (err.message.startsWith('Missing value for')) {
    console.error(`${err.message} — usage: <flag> <value>`);
    process.exit(2);
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/5103ccbdd4929864. Report an issue: GitHub.

Appendix: source

Thrown at scripts/install-guided.js:82

    harnesses: [],
    help: false,
    json: false,
    profile: undefined,
    yes: false,
  };
  const valueFlags = new Map([
    ['--harness', 'harnesses'],
    ['--claude-scope', 'claudeScope'],
    ['--claude-hooks', 'claudeHooks'],
    ['--profile', 'profile'],
  ]);

  for (let index = 0; index < argv.length; index += 1) {
    const argument = argv[index];
    if (valueFlags.has(argument)) {
      const value = argv[index + 1];
      if (!value || value.startsWith('--')) {
        throw new Error(`Missing value for ${argument}`);
      }
      if (value.length > 256) {
        throw new Error(`Value for ${argument} is too long.`);
      }
      const key = valueFlags.get(argument);
      options = key === 'harnesses'
        ? { ...options, harnesses: [...options.harnesses, value] }
        : { ...options, [key]: value };
      index += 1;
    } else if (argument === '--all-harnesses') {
      options = { ...options, allHarnesses: true };
    } else if (argument === '--yes' || argument === '-y') {
      options = { ...options, yes: true };
    } else if (argument === '--dry-run') {
      options = { ...options, dryRun: true };
    } else if (argument === '--json') {
      options = { ...options, json: true };
    } else if (argument === '--help' || argument === '-h') {

View on GitHub (pinned to 8321021c54)