affaan-m/ECC · error

Missing value for ${argument}

Error message

Missing value for ${argument}

What it means

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.

Source

Thrown at scripts/install-guided.js:81

    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 01e15490f0)

Solutions

  1. Supply a concrete value immediately after the flag, e.g. --harness claude
  2. Do not place another --flag where the value is expected
  3. If the value is optional in your flow, omit the flag entirely instead of leaving it valueless

Example fix

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

Strategy: validation

Validate before calling

const VALUE_FLAGS = new Set(['--harness','--claude-scope','--claude-hooks','--profile']);
for (let i = 0; i < argv.length; i++) {
  if (VALUE_FLAGS.has(argv[i])) {
    const v = argv[i + 1];
    if (!v || v.startsWith('--')) throw new Error(`Missing value for ${argv[i]}`);
  }
}

Type guard

function hasValueForFlag(argv, flag) {
  const i = argv.indexOf(flag);
  if (i === -1) return true; // flag absent, nothing to check
  const v = argv[i + 1];
  return typeof v === 'string' && v.length > 0 && !v.startsWith('--');
}

Try / catch

try { parseInstallGuidedArgs(argv); }
catch (err) {
  if (/^Missing value for/.test(err.message)) {
    console.error(`${err.message}. Supply a value, e.g. ${/harness/.test(err.message) ? '--harness claude' : '<value>'}.`);
    process.exit(2);
  }
  throw err;
}

Prevention

When it happens

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

Common situations: A wrapper script that appends --harness conditionally but forgets the value, or a user accidentally reordering flags so a value flag is last.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/5103ccbdd4929864. Report an issue: GitHub.