affaan-m/ECC · error

Missing value for

Error message

Missing value for ${argument}

What it means

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.

Solutions

  1. Provide the value immediately after the flag, e.g. `ecc setup --mode claude-plugin --scope project`.
  2. Check that a shell variable supplying the value is set and quoted: `--scope "$SCOPE"`.
  3. Run `ecc setup --help` to see which flags take values and their expected values.

Example fix

// before
npm run setup -- --scope

// after
npm run setup -- --scope project
Defensive patterns

Strategy: validation

Validate before calling

const valueFlags = ['--mode', '--scope', '--hooks'];
const i = valueFlags.indexOf(token);
if (i !== -1) {
  const next = argv[i + 1];
  if (!next || next.startsWith('--')) {
    throw new Error(`Missing value for ${valueFlags[i]}`);
  }
}

Try / catch

try {
  await runSetup(rawArgs);
} catch (err) {
  if (/^Missing value for /.test(err.message)) {
    console.error(err.message + '. Provide a value that does not start with --.');
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

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

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

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/9438643573db7325. Report an issue: GitHub.

Appendix: source

Thrown at scripts/setup.js:84

    hooks: undefined,
    json: false,
    mode: undefined,
    moveScope: false,
    scope: undefined,
    yes: false,
  };
  const valueFlags = new Map([
    ['--mode', 'mode'],
    ['--scope', 'scope'],
    ['--hooks', 'hooks'],
  ]);

  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}`);
      }
      options[valueFlags.get(argument)] = value;
      index += 1;
    } else if (argument === '--yes' || argument === '-y') {
      options.yes = true;
    } else if (argument === '--dry-run') {
      options.dryRun = true;
    } else if (argument === '--move-scope') {
      options.moveScope = true;
    } else if (argument === '--json') {
      options.json = true;
    } else if (argument === '--help' || argument === '-h') {
      options.help = true;
    } else {
      throw new Error(`Unknown argument: ${argument}`);
    }
  }

View on GitHub (pinned to 8321021c54)