stablyai/orca · error · Error
${name} must be a positive integer, received ${value}
Error message
${name} must be a positive integer, received ${value} What it means
Thrown by the hibernation-output-epoch-leak benchmark when ORCA_EPOCH_BENCH_CYCLES or ORCA_EPOCH_BENCH_PANES parses (via Number.parseInt) to a non-integer or a value <= 0. These env vars configure the simulated open→emit→close cycle count and panes-per-tab for the heap-leak benchmark.
Source
Thrown at config/scripts/hibernation-output-epoch-leak-benchmark.mjs:22
//
// recordAgentHibernationPaneOutput() adds one entry per pane (keyed by
// `tabId:leafId`, leafId a fresh UUID each open) on every PTY output chunk.
// Before the fix nothing purged those entries on permanent pane/worktree close,
// so the module-level Map grew for the renderer's whole lifetime. This script
// simulates N open→emit→close cycles and reports retained Map size with the
// purge disabled vs enabled.
import { performance } from 'node:perf_hooks'
import v8 from 'node:v8'
const CYCLES = Number.parseInt(process.env.ORCA_EPOCH_BENCH_CYCLES ?? '20000', 10)
const PANES_PER_TAB = Number.parseInt(process.env.ORCA_EPOCH_BENCH_PANES ?? '2', 10)
for (const [name, value] of [
['ORCA_EPOCH_BENCH_CYCLES', CYCLES],
['ORCA_EPOCH_BENCH_PANES', PANES_PER_TAB]
]) {
if (!Number.isInteger(value) || value <= 0) {
throw new Error(`${name} must be a positive integer, received ${value}`)
}
}
// Mirror of the module under test (agent-hibernation-output-activity.ts): a
// module-level Map of paneKey -> epoch, plus the tab-scoped purge the fix adds.
function makeActivity() {
const outputEpochByPaneKey = new Map()
return {
map: outputEpochByPaneKey,
record(paneKey) {
outputEpochByPaneKey.set(paneKey, (outputEpochByPaneKey.get(paneKey) ?? 0) + 1)
},
forgetTab(tabId) {
const prefix = `${tabId}:`
for (const paneKey of outputEpochByPaneKey.keys()) {
if (paneKey.startsWith(prefix)) {
outputEpochByPaneKey.delete(paneKey)
}View on GitHub (pinned to 1136503c6a)
Solutions
- Set both env vars to positive integers, or omit them to use the defaults (20000 cycles, 2 panes).
- Validate the env in the CI workflow before invoking the script.
Example fix
# before ORCA_EPOCH_BENCH_CYCLES=abc ORCA_EPOCH_BENCH_PANES=0 node config/scripts/hibernation-output-epoch-leak-benchmark.mjs # after ORCA_EPOCH_BENCH_CYCLES=50000 ORCA_EPOCH_BENCH_PANES=4 node config/scripts/hibernation-output-epoch-leak-benchmark.mjs
Defensive patterns
Strategy: validation
Validate before calling
function positiveIntEnv(name: string, fallback: string): number {
const v = Number.parseInt(process.env[name] ?? fallback, 10)
if (!Number.isInteger(v) || v <= 0) throw new Error(`${name} must be a positive integer, got ${process.env[name]}`)
return v
}
const CYCLES = positiveIntEnv('ORCA_EPOCH_BENCH_CYCLES', '20000')
const PANES_PER_TAB = positiveIntEnv('ORCA_EPOCH_BENCH_PANES', '2') Type guard
const isPositiveInteger = (v: unknown): v is number => typeof v === 'number' && Number.isInteger(v) && v > 0
Prevention
- Omit the env vars to use safe defaults rather than risk a bad override.
- Validate env vars in CI before invoking the benchmark.
When it happens
Trigger: Setting ORCA_EPOCH_BENCH_CYCLES to a non-numeric string ('abc'), zero, a negative number, a float string that parseInt floors to a bad value, or leaving it set to an empty/garbage value from a prior run.
Common situations: CI env var misconfiguration, typos, passing a float, or inheriting a stale/garbage value from the environment.
Related errors
- --trials must be a positive integer
- ${name} must be a positive integer, received ${value}
- ${name} must be a positive integer, received ${value}
- ORCA_ADVERTISED_URL_BENCH_ROUNDS must be even
- ${name} must be a positive integer, received ${value}
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/fbf8c40b05d03b06.
Report an issue: GitHub.