stablyai/orca · 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 advertised-url-watcher benchmark when one of ORCA_ADVERTISED_URL_BENCH_ITERATIONS / _ROUNDS / _WARMUP is not a safe positive integer. Number(env) is used, so non-numeric strings become NaN, decimals become floats, and oversized values exceed Number.isSafeInteger — each is rejected because the timing loops need integer counts.
Source
Thrown at config/scripts/advertised-url-watcher-benchmark.mjs:59
}
}
const { AdvertisedUrlWatcher, extractUrlCandidates, stripTerminalControls } = await import(
new URL('../../src/main/ports/advertised-url-watcher.ts', import.meta.url).href
)
const BUFFER_LIMIT = 4096
const ITERATIONS = Number(process.env.ORCA_ADVERTISED_URL_BENCH_ITERATIONS ?? '10000')
const ROUNDS = Number(process.env.ORCA_ADVERTISED_URL_BENCH_ROUNDS ?? '12')
const WARMUP = Number(process.env.ORCA_ADVERTISED_URL_BENCH_WARMUP ?? '1000')
for (const [name, value] of [
['ORCA_ADVERTISED_URL_BENCH_ITERATIONS', ITERATIONS],
['ORCA_ADVERTISED_URL_BENCH_ROUNDS', ROUNDS],
['ORCA_ADVERTISED_URL_BENCH_WARMUP', WARMUP]
]) {
if (!Number.isSafeInteger(value) || value <= 0) {
throw new Error(`${name} must be a positive integer, received ${value}`)
}
}
if (ROUNDS % 2 !== 0) {
throw new Error('ORCA_ADVERTISED_URL_BENCH_ROUNDS must be even')
}
class BeforePtyBuffer {
raw = ''
ingest(chunk) {
const chunkHasLineBreak = chunk.includes('\n') || chunk.includes('\r')
this.raw += chunk
if (this.raw.length > BUFFER_LIMIT) {
this.raw = this.raw.slice(-BUFFER_LIMIT)
}
if (!chunkHasLineBreak) {
return ''
}View on GitHub (pinned to 1136503c6a)
Solutions
- Set each env var to a positive integer within Number.MAX_SAFE_INTEGER, e.g. ORCA_ADVERTISED_URL_BENCH_ITERATIONS=10000 ORCA_ADVERTISED_URL_BENCH_ROUNDS=12 ORCA_ADVERTISED_URL_BENCH_WARMUP=1000.
- If unset, the defaults (10000/12/1000) are correct — remove the override entirely.
- Validate the env in the workflow with a regex (^[1-9][0-9]*$) before invoking the benchmark.
- For very large stress runs, scale ROUNDS rather than ITERATIONS to stay within safe-integer range.
Example fix
// before // ORCA_ADVERTISED_URL_BENCH_ITERATIONS=1e21 node config/scripts/advertised-url-watcher-benchmark.mjs // -> 'ORCA_ADVERTISED_URL_BENCH_ITERATIONS must be a positive integer, received 1e+21' // after // ORCA_ADVERTISED_URL_BENCH_ITERATIONS=20000 node config/scripts/advertised-url-watcher-benchmark.mjs
Defensive patterns
Strategy: validation
Validate before calling
function readPositiveIntEnv(name, fallback) {
const raw = process.env[name]
if (raw == null || raw === '') return fallback
const n = Number(raw)
if (!Number.isSafeInteger(n) || n <= 0) {
throw new Error(`${name} must be a positive safe integer, got '${raw}'`)
}
return n
}
// const ITERATIONS = readPositiveIntEnv('ORCA_ADVERTISED_URL_BENCH_ITERATIONS', 10000) Type guard
function isPositiveSafeInteger(value) {
return Number.isSafeInteger(value) && value > 0
} Prevention
- Prefer unsetting the env var to use defaults rather than overriding with a near-equivalent.
- Validate env values in the CI workflow with ^[1-9][0-9]*$ before invoking the benchmark.
- Keep iteration counts within Number.MAX_SAFE_INTEGER; scale rounds rather than iterations for stress runs.
When it happens
Trigger: Setting ORCA_ADVERTISED_URL_BENCH_ITERATIONS=10000.5 (float), =1e21 (exceeds MAX_SAFE_INTEGER), =abc (NaN), =0 or negative, or unsetting and overriding with an empty string.
Common situations: Operator typo in a CI workflow env block; copying a value from another benchmark without adjusting precision; attempting a stress run with an absurd iteration count.
Related errors
- ORCA_ADVERTISED_URL_BENCH_ROUNDS must be even
- ${name} must be a positive integer, received ${value}
- ${name} must be a positive integer, received ${value}
- ORCA_REPLAY_BENCH_SECONDS must be positive, received ${SECON
- ${name} must be a positive integer, received ${value}
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/86c4288a9b434936.
Report an issue: GitHub.