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
Startup guard in the MJPEG frame parser allocation benchmark. Identical pattern to the TOC benchmark: Number.parseInt's ORCA_MJPEG_BENCH_FPS, _SECONDS, _FRAME_BYTES with default fallbacks and rejects non-integer or <=0 values, naming the bad var and value.
Source
Thrown at config/scripts/mjpeg-frame-parser-alloc-benchmark.mjs:37
// implementation calls trackedCopy() wherever it would allocate a copy, so the
// reported "bytes copied" is exact and independent of GC timing.
let copiedBytes = 0
function trackedCopy(buf) {
copiedBytes += buf.length
return Buffer.from(buf)
}
const FPS = Number.parseInt(process.env.ORCA_MJPEG_BENCH_FPS ?? '30', 10)
const SECONDS = Number.parseInt(process.env.ORCA_MJPEG_BENCH_SECONDS ?? '30', 10)
const FRAME_BYTES = Number.parseInt(process.env.ORCA_MJPEG_BENCH_FRAME_BYTES ?? '184320', 10) // ~180 KiB
for (const [name, value] of [
['ORCA_MJPEG_BENCH_FPS', FPS],
['ORCA_MJPEG_BENCH_SECONDS', SECONDS],
['ORCA_MJPEG_BENCH_FRAME_BYTES', FRAME_BYTES]
]) {
if (!Number.isInteger(value) || value <= 0) {
throw new Error(`${name} must be a positive integer, received ${value}`)
}
}
const JPEG_START = Buffer.from([0xff, 0xd8])
const JPEG_END = Buffer.from([0xff, 0xd9])
function makeFrame(seed) {
const body = Buffer.alloc(FRAME_BYTES - 4)
// Avoid an accidental 0xff 0xd9 inside the body so the frame boundary is clean.
body.fill(seed % 251 || 1)
return Buffer.concat([JPEG_START, body, JPEG_END])
}
// --- old implementation: copy chunk + copy every frame -----------------------
function extractOld(pending, chunk, maxPendingBytes = 2 * 1024 * 1024) {
let cursor = pending.length > 0 ? Buffer.concat([pending, chunk]) : trackedCopy(chunk)
const frames = []
while (cursor.length > 0) {View on GitHub (pinned to 1136503c6a)
Solutions
- Unset the offending var to fall back to 30/30/184320
- Set a positive integer: ORCA_MJPEG_BENCH_FRAME_BYTES=184320 node mjpeg-frame-parser-alloc-benchmark.mjs
- Inspect the exported value byte-for-byte: printf '%s' "$ORCA_MJPEG_BENCH_FPS" | od -c
- Validate in the wrapping script with ^[1-9][0-9]*$ before exporting
Example fix
# before ORCA_MJPEG_BENCH_FPS=0 node config/scripts/mjpeg-frame-parser-alloc-benchmark.mjs # after node config/scripts/mjpeg-frame-parser-alloc-benchmark.mjs
Defensive patterns
Strategy: validation
Validate before calling
function positiveIntEnv(name, fallback) {
const raw = process.env[name]
if (raw === undefined) return fallback
if (!/^[1-9][0-9]*$/.test(raw)) {
throw new Error(`${name} must be a positive integer, received ${raw}`)
}
return Number.parseInt(raw, 10)
} Type guard
function isPositiveInt(v) {
return Number.isInteger(v) && v > 0
} Prevention
- Validate in CI before exporting with a positive-integer regex
- Unset vars to fall back to 30/30/184320 rather than passing empty values
- Check byte-for-byte for whitespace when an unexpected NaN appears
When it happens
Trigger: Any of the three ORCA_MJPEG_BENCH_* env vars set to a non-numeric, empty, zero, or negative value.
Common situations: CI matrix exporting the var with a typo; inheriting a frame size tuned for a different resolution that was set to 0; quoting artifacts leaving an empty string.
Related errors
- ${name} must be a positive integer, received ${value}
- ${name} must be a positive integer, received ${value}
- Missing helper process record path
- ${name} must be positive, received ${value}
- advertised-url-watcher.ts no longer contains \`${marker}\`
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/e580eadd9c07e1f2.
Report an issue: GitHub.