stablyai/orca · error · Error

${name} must be an integer from 1 through ${maximum}

Error message

${name} must be an integer from 1 through ${maximum}

What it means

Thrown by readProbeInteger() in the retirement probe when one of the tuning env vars (ORCA_PROBE_CYCLES, ORCA_PROBE_CONCURRENCY, ORCA_PROBE_SETTLE_MS, ORCA_PROBE_CLEANUP_TIMEOUT_MS) is set but not a safe integer in [1, maximum]. Each has a fallback if unset, so this only fires when an explicit value is out of bounds.

Source

Thrown at config/scripts/remote-shared-control-retirement-probe.ts:247

          .sort((left, right) => right.memory - left.memory)
          .slice(0, 5)
          .map((session) => ({
            pid: session.pid,
            cpu: session.cpu,
            memory: session.memory
          }))
      }))
  }
}

function readProbeInteger(name: string, fallback: number, maximum: number): number {
  const value = process.env[name]
  if (value === undefined) {
    return fallback
  }
  const parsed = Number(value)
  if (!Number.isSafeInteger(parsed) || parsed < 1 || parsed > maximum) {
    throw new Error(`${name} must be an integer from 1 through ${maximum}`)
  }
  return parsed
}

function wait(delayMs: number): Promise<void> {
  return new Promise((resolve) => setTimeout(resolve, delayMs))
}

void main().catch((error: unknown) => {
  console.error(error)
  process.exitCode = 1
})

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Omit the env var to use its documented fallback (CYCLES=10, CONCURRENCY=25, SETTLE_MS=250, CLEANUP_TIMEOUT_MS=10000).
  2. Set the value within its allowed range: CYCLES 1–100, CONCURRENCY 1–200, SETTLE_MS 1–5000, CLEANUP_TIMEOUT_MS 1–30000.

Example fix

// before
ORCA_PROBE_CONCURRENCY=500 ORCA_PROBE_ENVIRONMENT_NAME=env1 node --import tsx .../remote-shared-control-retirement-probe.ts
// after
ORCA_PROBE_CONCURRENCY=200 ORCA_PROBE_ENVIRONMENT_NAME=env1 node --import tsx .../remote-shared-control-retirement-probe.ts
Defensive patterns

Strategy: validation

Validate before calling

function readBoundedInt(name, fallback, maximum) {
  const value = process.env[name]
  if (value === undefined) return fallback
  const parsed = Number(value)
  if (!Number.isSafeInteger(parsed) || parsed < 1 || parsed > maximum) {
    throw new Error(`${name} must be an integer from 1 through ${maximum}`)
  }
  return parsed
}

Type guard

function isBoundedSafeInt(value, max) {
  return Number.isSafeInteger(value) && value >= 1 && value <= max
}

Prevention

When it happens

Trigger: Setting a probe env var to 0, a negative number, a decimal, a value above its cap (e.g. ORCA_PROBE_CONCURRENCY=500 when max is 200), or a non-numeric string. Number.isSafeInteger rejects NaN, Infinity, and decimals.

Common situations: A developer ramps up concurrency past the documented ceiling, or sets CYCLES=0 to skip, not realizing the minimum is 1.

Related errors


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