affaan-m/ECC · error · Error

${flagName} requires a value

Error message

${flagName} requires a value

What it means

Thrown by readValue in scripts/operator-readiness-dashboard.js when a value-taking flag (--write, --root, --repo, --allow-untracked, --max-open-prs, --max-open-issues, --max-dirty-files, --generated-at) is the last token or is immediately followed by another `--` flag. Same manual-parser pattern as the sibling readiness script.

Source

Thrown at scripts/operator-readiness-dashboard.js:45

    '  --write <path>             Write json or markdown output to a file',
    '  --root <dir>               Repository root to inspect (default: cwd)',
    '  --repo <owner/repo>        GitHub repo to inspect; repeatable',
    '  --skip-github              Skip live GitHub queue/discussion checks',
    '  --max-open-prs <n>         PR budget passed through to platform:audit',
    '  --max-open-issues <n>      Issue budget passed through to platform:audit',
    '  --max-dirty-files <n>      Dirty-file budget passed through to platform:audit',
    '  --allow-untracked <path>   Ignore untracked files under path; repeatable',
    '  --use-env-github-token     Keep GITHUB_TOKEN when invoking gh',
    '  --generated-at <iso>       Override generatedAt for deterministic tests',
    '  --exit-code                Return 2 when the objective is not ready',
    '  --help, -h                 Show this help',
  ].join('\n'));
}

function readValue(args, index, flagName) {
  const value = args[index + 1];
  if (!value || value.startsWith('--')) {
    throw new Error(`${flagName} requires a value`);
  }
  return value;
}

function parseIntegerFlag(value, flagName) {
  const parsed = Number.parseInt(value, 10);
  if (!Number.isFinite(parsed) || parsed < 0) {
    throw new Error(`Invalid ${flagName}: ${value}`);
  }
  return parsed;
}

function normalizeRelativePrefix(value) {
  const normalized = String(value || '')
    .replace(/\\/g, '/')
    .replace(/^\.\/+/, '')
    .replace(/\/+$/, '');
  return normalized ? `${normalized}/` : '';

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Supply the value immediately after the flag: `--write report.json`.
  2. Use the equals form: `--write=report.json`.
  3. Validate that variables expanding into flag values are non-empty before invoking the CLI.

Example fix

// before
node scripts/operator-readiness-dashboard.js --repo --json
// after
node scripts/operator-readiness-dashboard.js --repo owner/repo --json
Defensive patterns

Strategy: validation

Validate before calling

const VALUE_FLAGS = new Set(['--write', '--root', '--repo', '--allow-untracked', '--max-open-prs', '--max-open-issues', '--max-dirty-files', '--generated-at']);
function validateValueFlags(argv) {
  for (let i = 0; i < argv.length; i++) {
    if (VALUE_FLAGS.has(argv[i])) {
      const next = argv[i + 1];
      if (!next || next.startsWith('--')) throw new Error(`${argv[i]} requires a value`);
    }
  }
}

Prevention

When it happens

Trigger: Running `node scripts/operator-readiness-dashboard.js --write` at end of line, or `--repo --json` where the repo value is missing. Equals-form variants (`--repo=owner/name`) bypass readValue entirely and are safe.

Common situations: A CI step templating flags where a variable for the value is empty; reordered flags that place a value-taking flag next to the following flag; truncation during copy-paste.

Related errors


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