affaan-m/ECC · warning

Unknown option: ${arg}

Error message

Unknown option: ${arg}

What it means

The loop-status.js parseArgs loop is an explicit if/else chain over a fixed flag set; the final else throws `Unknown option: <arg>` for anything unrecognized. Recognized flags are --help/-h, --json, --home, --transcript, --limit, --bash-timeout-seconds, --wake-grace-multiplier, --now, --exit-code, --watch, --watch-count, --watch-interval-seconds, --write-dir. Notably there is no shorthand and no positional handling.

Source

Thrown at scripts/loop-status.js:121

      index += 1;
    } else if (arg === '--now') {
      options.now = readValue(args, index, arg);
      index += 1;
    } else if (arg === '--exit-code') {
      options.exitCode = true;
    } else if (arg === '--watch') {
      options.watch = true;
    } else if (arg === '--watch-count') {
      options.watchCount = readPositiveInteger(readValue(args, index, arg), arg);
      index += 1;
    } else if (arg === '--watch-interval-seconds') {
      options.watchIntervalSeconds = readPositiveNumber(readValue(args, index, arg), arg);
      index += 1;
    } else if (arg === '--write-dir') {
      options.writeDir = readValue(args, index, arg);
      index += 1;
    } else {
      throw new Error(`Unknown option: ${arg}`);
    }
  }

  if (options.exitCode && options.watch && options.watchCount === null) {
    throw new Error('--exit-code with --watch requires --watch-count so the process can exit');
  }

  return options;
}

function normalizeOptions(options = {}) {
  return {
    ...options,
    bashTimeoutSeconds: options.bashTimeoutSeconds ?? DEFAULT_BASH_TIMEOUT_SECONDS,
    exitCode: Boolean(options.exitCode),
    limit: options.limit ?? DEFAULT_LIMIT,
    transcriptPaths: options.transcriptPaths || [],
    watch: Boolean(options.watch),

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Run `node scripts/loop-status.js --help` and copy flag names exactly.
  2. Pass transcript files via `--transcript <path>` (repeatable), not as bare positionals.
  3. Strip unsupported args in wrapper scripts before forwarding.

Example fix

# before
node scripts/loop-status.js --format json ~/.claude/projects/x/s.jsonl

# after
node scripts/loop-status.js --json --transcript ~/.claude/projects/x/s.jsonl
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = new Set(['--help','-h','--json','--home','--transcript','--limit','--bash-timeout-seconds','--wake-grace-multiplier','--now','--exit-code','--watch','--watch-count','--watch-interval-seconds','--write-dir']);
function validateLoopStatusArgs(argv) {
  for (const a of argv) { if (a.startsWith('-') && !KNOWN.has(a)) throw new Error(`Unknown option: ${a}`); }
}

Try / catch

try { parseArgs(process.argv); }
catch (err) { if (/Unknown option/.test(err.message)) { console.error(err.message); printHelp(2); } else throw err; }

Prevention

When it happens

Trigger: Typing a flag from a different script (--filter, --format). Using a hyphen variant like --watch_interval_seconds. Passing a positional path argument (the script only takes --transcript). A leading dash typo such as `-json`.

Common situations: Cross-contaminating flags between ECC scripts. Auto-complete inserting the wrong long option. Wrapper scripts forwarding unknown args via "$@".

Related errors


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