stablyai/orca · error · Error

ORCA_PTY_BENCH_PAYLOAD_CHARS must be positive, received ${PA

Error message

ORCA_PTY_BENCH_PAYLOAD_CHARS must be positive, received ${PAYLOAD_CHARS}

What it means

Thrown by config/scripts/pty-batch-flush-benchmark.mjs when ORCA_PTY_BENCH_PAYLOAD_CHARS fails `!Number.isInteger(PAYLOAD_CHARS) || PAYLOAD_CHARS <= 0`. PAYLOAD_CHARS (default 262144) is the per-PTY simulated payload size in characters, fed into `padEnd(PAYLOAD_CHARS, 'x')` in makePendingData(). A non-positive value would produce an empty or invalid payload, so the guard rejects it before the benchmark allocates data.

Source

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

const PAYLOAD_CHARS = Number.parseInt(process.env.ORCA_PTY_BENCH_PAYLOAD_CHARS ?? '262144', 10)
const RUNS = Number.parseInt(process.env.ORCA_PTY_BENCH_RUNS ?? '30', 10)
const MEASURE_TIMER_DELAYS = process.env.ORCA_PTY_BENCH_MEASURE_TIMER_DELAYS !== '0'
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
}

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Set ORCA_PTY_BENCH_PAYLOAD_CHARS to a positive integer (the default 262144 is a sensible baseline).
  2. Unset it to accept the default of 262144.
  3. If you wanted a small-payload run, use a small but positive value such as 1024.

Example fix

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

// after
ORCA_PTY_BENCH_PAYLOAD_CHARS=1024 node config/scripts/pty-batch-flush-benchmark.mjs
Defensive patterns

Strategy: validation

Validate before calling

const raw = process.env.ORCA_PTY_BENCH_PAYLOAD_CHARS
if (raw !== undefined && (!Number.isInteger(Number(raw)) || Number(raw) <= 0)) {
  throw new Error(`ORCA_PTY_BENCH_PAYLOAD_CHARS='${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: Set ORCA_PTY_BENCH_PAYLOAD_CHARS to `0`, a negative number, an empty string, or a non-numeric value, then run the benchmark script. The module-level parseInt at line 6 produces NaN for non-numeric input, and line 23-24 throws.

Common situations: A user tries to run a 'tiny payload' micro-benchmark and sets PAYLOAD_CHARS=0 thinking it means 'minimal', or a CI matrix template leaves the variable blank. Misunits like `256k` (parseInt yields 256, actually valid but surprising) or `0x100` are common copy-paste mistakes.

Related errors


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