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 at module load time when either ORCA_DIFF_BLOB_BENCH_ITERATIONS or ORCA_DIFF_BLOB_BENCH_WARMUP env var, coerced via Number(), is not a safe positive integer (<= 0, fractional, NaN, or out of safe-integer range). The check runs before any benchmarking begins (git-diff-blob-concurrency-benchmark.mjs:18-28).

Source

Thrown at config/scripts/git-diff-blob-concurrency-benchmark.mjs:26

//
// This spawns the real `git` binary against this repo, so it measures actual
// process-launch and read cost rather than a model of it. Over SSH each diff is
// one relay RPC and the two spawns run host-local inside the relay, so the same
// relative saving applies to remote-host spawn time, not to network round trips.
import { execFile } from 'node:child_process'
import { performance } from 'node:perf_hooks'
import { fileURLToPath } from 'node:url'

const REPO_ROOT = fileURLToPath(new URL('../..', import.meta.url))
const ITERATIONS = Number(process.env.ORCA_DIFF_BLOB_BENCH_ITERATIONS ?? '10')
const WARMUP = Number(process.env.ORCA_DIFF_BLOB_BENCH_WARMUP ?? '3')

for (const [name, value] of [
  ['ORCA_DIFF_BLOB_BENCH_ITERATIONS', ITERATIONS],
  ['ORCA_DIFF_BLOB_BENCH_WARMUP', WARMUP]
]) {
  if (!Number.isSafeInteger(value) || value <= 0) {
    throw new Error(`${name} must be a positive integer, received ${value}`)
  }
}

function git(args) {
  return new Promise((resolve, reject) => {
    execFile('git', args, { cwd: REPO_ROOT, maxBuffer: 256 * 1024 * 1024 }, (error, stdout) =>
      error ? reject(error) : resolve(stdout)
    )
  })
}

// Pre-fix: await one side, then the other.
async function readSequential(leftRef, rightRef, filePath) {
  const left = await git(['show', '--end-of-options', `${leftRef}:${filePath}`])
  const right = await git(['show', '--end-of-options', `${rightRef}:${filePath}`])
  return left.length + right.length
}

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Set the env var to a positive integer, e.g. ORCA_DIFF_BLOB_BENCH_ITERATIONS=20.
  2. Unset the env var to fall back to the defaults (iterations=10, warmup=3).
  3. If scripting, coerce and validate before exporting: only export if Number.isSafeInteger(n) && n > 0.

Example fix

# before
export ORCA_DIFF_BLOB_BENCH_ITERATIONS=0
# after
export ORCA_DIFF_BLOB_BENCH_ITERATIONS=20  # or unset to use default 10
Defensive patterns

Strategy: validation

Validate before calling

function positiveIntEnv(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 integer, received ${raw}`)
  }
  return n
}
const ITERATIONS = positiveIntEnv('ORCA_DIFF_BLOB_BENCH_ITERATIONS', 10)

Type guard

function isPositiveSafeInteger(value) {
  return Number.isSafeInteger(value) && value > 0
}

Prevention

When it happens

Trigger: Setting ORCA_DIFF_BLOB_BENCH_ITERATIONS=0; a negative value; a fractional value like '2.5'; a non-numeric value like 'abc' (Number yields NaN); an empty string (Number yields 0); leaving it unset is fine (defaults 10/3).

Common situations: A CI override that sets the env to 0 to 'skip'; a typo or trailing space in the env value; a wrapper that passes a float; copy-pasting a value with units like '10x'.

Related errors


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