stablyai/orca · error · Error
${name} must be positive, received ${value}
Error message
${name} must be positive, received ${value} What it means
Startup validation in the Zustand selector-fanout benchmark: it parses three env vars (ORCA_ZUSTAND_BENCH_SUBSCRIBERS, ORCA_ZUSTAND_BENCH_WRITES, ORCA_ZUSTAND_BENCH_MAX_MS_PER_WRITE) and throws if any is non-finite or <= 0. The benchmark needs positive counts/durations to produce meaningful throughput numbers.
Source
Thrown at config/scripts/zustand-selector-fanout-benchmark.mjs:18
#!/usr/bin/env node
import { performance } from 'node:perf_hooks'
import process from 'node:process'
import { createStore } from 'zustand/vanilla'
const SUBSCRIBERS = Number.parseInt(process.env.ORCA_ZUSTAND_BENCH_SUBSCRIBERS ?? '2500', 10)
const WRITES = Number.parseInt(process.env.ORCA_ZUSTAND_BENCH_WRITES ?? '2000', 10)
const MAX_MILLISECONDS_PER_WRITE = Number.parseFloat(
process.env.ORCA_ZUSTAND_BENCH_MAX_MS_PER_WRITE ?? '5'
)
for (const [name, value] of [
['ORCA_ZUSTAND_BENCH_SUBSCRIBERS', SUBSCRIBERS],
['ORCA_ZUSTAND_BENCH_WRITES', WRITES],
['ORCA_ZUSTAND_BENCH_MAX_MS_PER_WRITE', MAX_MILLISECONDS_PER_WRITE]
]) {
if (!Number.isFinite(value) || value <= 0) {
throw new Error(`${name} must be positive, received ${value}`)
}
}
function measureRound() {
const stableProjection = Object.freeze({ activeRepoId: 'repo-1' })
const store = createStore(() => ({ unrelatedWrite: 0, stableProjection }))
let selectorRuns = 0
let renderInvalidations = 0
const unsubscribe = Array.from({ length: SUBSCRIBERS }, () => {
let previous = store.getState().stableProjection
return store.subscribe((state) => {
selectorRuns += 1
const next = state.stableProjection
if (!Object.is(previous, next)) {
renderInvalidations += 1
}
previous = next
})View on GitHub (pinned to 1136503c6a)
Solutions
- Set all three env vars to positive finite numbers (e.g. SUBSCRIBERS=2500 WRITES=2000 MAX_MS_PER_WRITE=5).
- Unset the vars to fall back to the documented defaults.
- Check for an empty-string export (`export ORCA_ZUSTAND_BENCH_WRITES=`) which Number.parseInt('',10) turns into NaN.
Example fix
// before
if (!Number.isFinite(value) || value <= 0) {
throw new Error(`${name} must be positive, received ${value}`)
}
// after — allow empty/unset to fall back to default
const raw = process.env[name]
if (raw !== undefined && raw !== '' && (!Number.isFinite(value) || value <= 0)) {
throw new Error(`${name} must be positive, received ${value}`)
} Defensive patterns
Strategy: validation
Validate before calling
// Centralized env parser that treats empty/unset as default
function positiveEnv(name: string, def: number): number {
const raw = process.env[name]
if (raw === undefined || raw === '') return def
const n = Number(raw)
if (!Number.isFinite(n) || n <= 0) {
throw new Error(`${name} must be positive, received ${raw}`)
}
return n
} Type guard
function isPositiveFinite(v: unknown): v is number {
return typeof v === 'number' && Number.isFinite(v) && v > 0
} Prevention
- Document the three env vars and their defaults in the benchmark header.
- Validate once at startup, not per round.
- Print the resolved values when --verbose is set so misconfigurations are visible.
When it happens
Trigger: Setting any of the three env vars to 0, a negative number, NaN, Infinity, or a non-numeric string (parseInt/parseFloat yield NaN).
Common situations: Copy-pasting a partial env override (e.g. ORCA_ZUSTAND_BENCH_SUBSCRIBERS=0 to 'disable'), typos like `SUBSCRIBERS=-1`, or an unset var that the default fallback should have covered but a wrapper exported an empty string.
Related errors
- ${name} must be a positive integer, received ${value}
- ${name} must be a positive integer, received ${value}
- ${name} must be a positive integer, received ${value}
- ORCA_PTY_BENCH_PTY_COUNT must be positive, received ${PTY_CO
- ORCA_PTY_BENCH_PAYLOAD_CHARS must be positive, received ${PA
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/75d9573e3b80ca0a.
Report an issue: GitHub.