stablyai/orca · error · Error

fixture-mib and trials must be positive integers

Error message

fixture-mib and trials must be positive integers

What it means

The legacy-worker-recovery-persistence benchmark reads --fixture-mib (default 24) and --trials (default 3) from argv and validates both are positive integers before allocating fixtures and running trials. Non-positive or non-integer values would produce a zero-byte filler, fractional trial counts, or NaN sizes that break the comparison.

Source

Thrown at config/scripts/legacy-worker-recovery-persistence-benchmark.mjs:20

// Run: node config/scripts/legacy-worker-recovery-persistence-benchmark.mjs
import { closeSync, fsyncSync, openSync, renameSync, rmSync, writeFileSync } from 'node:fs'
import { mkdtemp, open, readFile, rename } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { performance } from 'node:perf_hooks'
import { fileURLToPath } from 'node:url'

const repoRoot = fileURLToPath(new URL('../..', import.meta.url))
const runtimePath = join(repoRoot, 'src/main/runtime/orca-runtime.ts')
const args = new Map(
  process.argv.slice(2).map((value, index, values) => [value, values[index + 1]])
)
const fixtureMiB = Number(args.get('--fixture-mib') ?? 24)
const trials = Number(args.get('--trials') ?? 3)
const jsonOutput = process.argv.includes('--json')

if (!Number.isInteger(fixtureMiB) || fixtureMiB < 1 || !Number.isInteger(trials) || trials < 1) {
  throw new Error('fixture-mib and trials must be positive integers')
}

const runtimeSource = await readFile(runtimePath, 'utf8')
const recoveryStart = runtimeSource.indexOf(
  'private async persistLegacyWorkerTerminalRecoveryBatch'
)
const recoveryEnd = runtimeSource.indexOf(
  'private reconcileMissingLegacyWorkerTerminal',
  recoveryStart
)
const recoverySource = runtimeSource.slice(recoveryStart, recoveryEnd)
if (
  recoveryStart === -1 ||
  recoveryEnd === -1 ||
  !recoverySource.includes('await this.flushWorkspaceSessionOrThrowAsync()') ||
  recoverySource.includes('flushOrThrow()')
) {
  throw new Error('recovery persistence implementation changed; update this benchmark')

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Pass positive integers for both flags, or omit them to use defaults (24 MiB, 3 trials).
  2. Ensure each flag is immediately followed by its numeric value.
  3. Avoid decimals and units (the value is already in MiB).

Example fix

# before
node config/scripts/legacy-worker-recovery-persistence-benchmark.mjs --fixture-mib

# after
node config/scripts/legacy-worker-recovery-persistence-benchmark.mjs --fixture-mib 24 --trials 3
Defensive patterns

Strategy: validation

Validate before calling

function parsePositiveIntArg(map, flag, fallback) {
  const raw = map.get(flag)
  if (raw === undefined) return fallback
  const n = Number(raw)
  if (!Number.isInteger(n) || n < 1) throw new Error(`${flag} must be a positive integer`)
  return n
}

Prevention

When it happens

Trigger: Passing --fixture-mib or --trials as 0, a negative, a decimal, or a non-numeric string; passing the flag without a following value so the map resolves it to undefined → NaN.

Common situations: A trailing flag with no value; a decimal MiB; a typo like '--trials 3.'.

Related errors


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