affaan-m/ECC · error

Missing value for --limit

Error message

Missing value for --limit

What it means

The --limit flag in scripts/status.js takes a numeric count of sessions/rows to display. parseArgs post-validates that when --limit appears in argv a parsed.limit value was captured; if the flag has no following value the guard throws "Missing value for --limit".

Solutions

  1. Provide a numeric value: `--limit 20`.
  2. Check that the interpolated variable supplying the limit is defined and non-empty.
  3. Remove --limit to use the script's default limit.

Example fix

// before
node scripts/status.js --limit
// after
node scripts/status.js --limit 20
Defensive patterns

Strategy: validation

Validate before calling

const lIdx = process.argv.indexOf('--limit');
if (lIdx !== -1 && (!process.argv[lIdx + 1] || process.argv[lIdx + 1].startsWith('--') || Number.isNaN(Number(process.argv[lIdx + 1])))) {
  throw new Error('Missing or invalid value for --limit');
}

Try / catch

try {
  runStatus(argv);
} catch (e) {
  if (e.message === 'Missing value for --limit') {
    console.error('Usage: node scripts/status.js --limit <number>');
    process.exitCode = 1;
  } else throw e;
}

Prevention

When it happens

Trigger: Running `node scripts/status.js --limit` as the last argument, or `--limit --json` where --json is treated as a separate flag leaving limit unset.

Common situations: Forgetting the number; script-building code that interpolates an undefined limit variable; commands truncated when pasted.

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/08cfcf5f0cfda15c. Report an issue: GitHub.

Appendix: source

Thrown at scripts/status.js:75

    } else {
      throw new Error(`Unknown argument: ${arg}`);
    }
  }

  if (parsed.json && parsed.markdown) {
    throw new Error('Choose only one output format: --json or --markdown');
  }

  if (args.includes('--db') && !parsed.dbPath) {
    throw new Error('Missing value for --db');
  }

  if (args.includes('--write') && !parsed.writePath) {
    throw new Error('Missing value for --write');
  }

  if (args.includes('--limit') && !parsed.limit) {
    throw new Error('Missing value for --limit');
  }

  return parsed;
}

function printActiveSessions(section) {
  console.log(`Active sessions: ${section.activeCount}`);
  if (section.sessions.length === 0) {
    console.log('  - none');
    return;
  }

  for (const session of section.sessions) {
    console.log(`  - ${session.id} [${session.harness}/${session.adapterId}] ${session.state}`);
    console.log(`    Repo: ${session.repoRoot || '(unknown)'}`);
    console.log(`    Started: ${session.startedAt || '(unknown)'}`);
    console.log(`    Workers: ${session.workerCount}`);
  }

View on GitHub (pinned to 8321021c54)