stablyai/orca · error · Error

ORCA_PTY_BENCH_RUNS must be positive, received ${RUNS}

Error message

ORCA_PTY_BENCH_RUNS must be positive, received ${RUNS}

What it means

Thrown by config/scripts/pty-batch-flush-benchmark.mjs when ORCA_PTY_BENCH_RUNS fails `!Number.isInteger(RUNS) || RUNS <= 0`. RUNS (default 30) is the number of measurement iterations the benchmark averages over; a non-positive value would make the timing loop produce no samples. Parsed at module load from the env, so the guard at line 26-27 fires immediately on bad input.

Source

Thrown at config/scripts/pty-batch-flush-benchmark.mjs:27

const INGRESS_CHUNKS = Number.parseInt(process.env.ORCA_PTY_BENCH_INGRESS_CHUNKS ?? '96', 10)
const INGRESS_CHUNK_CHARS = Number.parseInt(process.env.ORCA_PTY_BENCH_INGRESS_CHARS ?? '65536', 10)
const CHUNK_CHARS = 16 * 1024
const MAX_WRITES_PER_SLICE = 2
const RECENT_PTY_OUTPUT_LIMIT = 4096
const MAX_TAIL_LINES = 2000
const MAX_TAIL_CHARS = 256 * 1024
const MAX_TAIL_PARTIAL_CHARS = 4000
const OSC_TITLE_RE = /\x1b\]([012]);([^\x07\x1b]*?)(?:\x07|\x1b\\)/g
const URL_CANDIDATE_PATTERN = /\bhttps?:\/\/[^\s<>"'`]+/gi

if (!Number.isInteger(PTY_COUNT) || PTY_COUNT <= 0) {
  throw new Error(`ORCA_PTY_BENCH_PTY_COUNT must be positive, received ${PTY_COUNT}`)
}
if (!Number.isInteger(PAYLOAD_CHARS) || PAYLOAD_CHARS <= 0) {
  throw new Error(`ORCA_PTY_BENCH_PAYLOAD_CHARS must be positive, received ${PAYLOAD_CHARS}`)
}
if (!Number.isInteger(RUNS) || RUNS <= 0) {
  throw new Error(`ORCA_PTY_BENCH_RUNS must be positive, received ${RUNS}`)
}
if (!Number.isInteger(INGRESS_CHUNKS) || INGRESS_CHUNKS <= 0) {
  throw new Error(`ORCA_PTY_BENCH_INGRESS_CHUNKS must be positive, received ${INGRESS_CHUNKS}`)
}
if (!Number.isInteger(INGRESS_CHUNK_CHARS) || INGRESS_CHUNK_CHARS <= 0) {
  throw new Error(`ORCA_PTY_BENCH_INGRESS_CHARS must be positive, received ${INGRESS_CHUNK_CHARS}`)
}

function makePendingData() {
  const pending = new Map()
  for (let index = 0; index < PTY_COUNT; index++) {
    pending.set(`pty-${index}`, `${index}:`.padEnd(PAYLOAD_CHARS, 'x'))
  }
  return pending
}

function simulateWebContentsSend(id, data) {
  return v8.serialize({ channel: 'pty:data', payload: { id, data } }).byteLength

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Set ORCA_PTY_BENCH_RUNS to a positive integer; for quick smoke runs use a small value like 3.
  2. Unset it to accept the default of 30.
  3. Validate in your wrapper that the value parses to a positive integer before invoking.

Example fix

// before
ORCA_PTY_BENCH_RUNS=0 node config/scripts/pty-batch-flush-benchmark.mjs

// after
ORCA_PTY_BENCH_RUNS=3 node config/scripts/pty-batch-flush-benchmark.mjs
Defensive patterns

Strategy: validation

Validate before calling

const raw = process.env.ORCA_PTY_BENCH_RUNS
if (raw !== undefined && (!Number.isInteger(Number(raw)) || Number(raw) <= 0)) {
  throw new Error(`ORCA_PTY_BENCH_RUNS='${raw}' must be a positive integer`)
}

Type guard

function isPositiveInt(value) {
  const n = Number(value)
  return Number.isInteger(n) && n > 0
}

Prevention

When it happens

Trigger: Run the benchmark with ORCA_PTY_BENCH_RUNS set to `0`, `-5`, an empty string, or a non-numeric token. parseInt at line 7 yields NaN for non-numeric input and the guard at line 26 throws.

Common situations: A developer sets RUNS=0 intending to 'dry-run' the benchmark (there is no dry-run mode), or a smoke-test wrapper sets RUNS to an empty value. Setting RUNS to a float like `1.5` actually passes (parseInt floors to 1), but `1.5px` style garbage fails.

Related errors


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