stablyai/orca · error · Error

Invalid --${key}: ${options[key]}

Error message

Invalid --${key}: ${options[key]}

What it means

Thrown by the post-parse validation loop in parseArgs when any numeric option (warmupMs, sampleMs, intervalMs, worktrees, lineageDepth, agentsPerWorktree, zustandPublications, zustandPublicationIntervalMs, syntheticVisibleSpinners, syntheticSpinnerSteps) is non-finite or negative. Number() on garbage or empty yields NaN, which Number.isFinite rejects.

Source

Thrown at config/scripts/run-idle-cpu-benchmark.mjs:115

      process.exit(0)
    } else {
      throw new Error(`Unknown argument: ${arg}`)
    }
  }
  for (const key of [
    'warmupMs',
    'sampleMs',
    'intervalMs',
    'worktrees',
    'lineageDepth',
    'agentsPerWorktree',
    'zustandPublications',
    'zustandPublicationIntervalMs',
    'syntheticVisibleSpinners',
    'syntheticSpinnerSteps'
  ]) {
    if (!Number.isFinite(options[key]) || options[key] < 0) {
      throw new Error(`Invalid --${key}: ${options[key]}`)
    }
  }
  options.worktrees = Math.max(1, Math.floor(options.worktrees))
  options.intervalMs = Math.max(250, Math.floor(options.intervalMs))
  options.lineageDepth = Math.floor(options.lineageDepth)
  options.agentsPerWorktree = Math.floor(options.agentsPerWorktree)
  options.zustandPublications = Math.floor(options.zustandPublications)
  options.zustandPublicationIntervalMs = Math.max(
    1,
    Math.floor(options.zustandPublicationIntervalMs)
  )
  options.syntheticVisibleSpinners = Math.max(0, Math.floor(options.syntheticVisibleSpinners))
  options.syntheticSpinnerSteps = Math.max(1, Math.floor(options.syntheticSpinnerSteps))
  if (!['smooth', 'steps'].includes(options.syntheticSpinnerAnimation)) {
    throw new Error(`Invalid --synthetic-spinner-animation: ${options.syntheticSpinnerAnimation}`)
  }
  if (options.lineageDepth > 0 && options.worktrees < 2) {
    throw new Error('--lineage-depth requires at least two --worktrees')

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Provide a non-negative number (integer or decimal; later floored) for the flagged option.
  2. Strip units/quotes from shell-passed values.
  3. Default unset numeric env-like values rather than passing empty strings.

Example fix

# before
node config/scripts/run-idle-cpu-benchmark.mjs --warmup-ms abc
# after
node config/scripts/run-idle-cpu-benchmark.mjs --warmup-ms 15000
Defensive patterns

Strategy: validation

Validate before calling

const NUMERIC_KEYS = ['warmupMs','sampleMs','intervalMs','worktrees','lineageDepth','agentsPerWorktree','zustandPublications','zustandPublicationIntervalMs','syntheticVisibleSpinners','syntheticSpinnerSteps']
for (const key of NUMERIC_KEYS) {
  if (!Number.isFinite(options[key]) || options[key] < 0) {
    throw new Error(`Invalid --${key}: ${options[key]}`)
  }
}

Type guard

function isNonNegativeNumber(value) {
  return typeof value === 'number' && Number.isFinite(value) && value >= 0
}

Try / catch

try {
  options = parseArgs(argv)
} catch (err) {
  if (/^Invalid --/.test(err.message)) { printUsage(); process.exit(2) }
  throw err
}

Prevention

When it happens

Trigger: Passing a non-numeric value to a numeric flag ('--warmup-ms abc', '--worktrees <empty>'), a negative number, or Infinity/NaN from an expression.

Common situations: Shell-expanding an unset variable to empty (Number('') === 0 is fine, but Number('abc') is NaN), passing floats where integers are expected after flooring still validates first, copy-pasting units ('5000ms').

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/b31405a59fc79ade. Report an issue: GitHub.