stablyai/orca · error · Error

--expect must be retained or reaped

Error message

--expect must be retained or reaped

What it means

The --expect flag received a value outside the allowed set {retained, reaped}. This also fires when --expect is omitted entirely: options.expect defaults to '' (line 391), which is not in the allowed list. These are the only two expectation modes the benchmark supports.

Source

Thrown at config/scripts/macos-computer-helper-owner-loss-benchmark.mjs:406

}

function parseArgs(argv) {
  const options = { expect: '', trials: DEFAULT_TRIALS, output: '' }
  for (let index = 0; index < argv.length; index += 1) {
    const arg = argv[index]
    const value = argv[index + 1]
    if (arg === '--expect' || arg === '--trials' || arg === '--output') {
      if (!value) {
        throw new Error(`Missing value for ${arg}`)
      }
      options[arg.slice(2)] = arg === '--trials' ? Number(value) : value
      index += 1
    } else {
      throw new Error(`Unknown argument: ${arg}`)
    }
  }
  if (!['retained', 'reaped'].includes(options.expect)) {
    throw new Error('--expect must be retained or reaped')
  }
  if (!Number.isInteger(options.trials) || options.trials < 1) {
    throw new Error('--trials must be a positive integer')
  }
  return options
}

function electronPath() {
  const electronModulePath = fileURLToPath(import.meta.resolve('electron'))
  return execFileSync(
    process.execPath,
    ['-e', `process.stdout.write(require(${JSON.stringify(electronModulePath)}))`],
    { encoding: 'utf8' }
  )
}

function buildArtifacts() {
  execFileSync('pnpm', ['exec', 'electron-vite', 'build'], {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Always pass --expect explicitly: `--expect reaped` or `--expect retained`
  2. Ensure no preceding flag consumes the --expect value (each flag reads argv[index+1])
  3. Check for typos: only 'retained' and 'reaped' are valid

Example fix

// before
node benchmark.mjs --trials 3
// (no --expect → defaults to '' → fails validation)

// after
node benchmark.mjs --expect reaped --trials 3
Defensive patterns

Strategy: validation

Validate before calling

// Validate --expect value before running
const VALID_EXPECTATIONS = new Set(['retained', 'reaped'])
const expectIndex = argv.indexOf('--expect')
if (expectIndex === -1) {
  throw new Error('--expect is required (retained or reaped)')
}
const expectValue = argv[expectIndex + 1]
if (!VALID_EXPECTATIONS.has(expectValue)) {
  throw new Error(`--expect must be 'retained' or 'reaped', got: ${expectValue}`)
}

Type guard

function isExpectation(value) {
  return value === 'retained' || value === 'reaped'
}

Prevention

When it happens

Trigger: options.expect is not 'retained' or 'reaped' at the post-parse validation (line 405). Causes: omitting --expect entirely (defaults to ''), passing an invalid value like 'killed', or the value being accidentally consumed by a preceding flag.

Common situations: Forgetting to pass --expect at all; typo in the value; --expect value consumed by a prior flag that also reads the next token; copy-paste from outdated docs.

Related errors


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