stablyai/orca · error · Error

Invalid ${name}: expected a finite number, got ${JSON.string

Error message

Invalid ${name}: expected a finite number, got ${JSON.stringify(raw)}

What it means

readFreezeNumberEnv reads a numeric configuration value (freeze soft/hard timeouts in ms) from a named process.env slot, falling back to a default when unset or blank. It throws when the raw string parses to a non-finite number — i.e. NaN or +/-Infinity — because a freeze timeout that is NaN/Infinity would silently disable or never trigger the freeze guard. Finite-number validation is the trust boundary for externally supplied timing.

Source

Thrown at config/scripts/live-remote-bulk-open-freeze-metrics.mjs:16

/**
 * Pure metrics helpers for the live remote bulk-open freeze harness.
 * Kept separate so unit tests can drive the same code the repro uses.
 */

export const DEFAULT_SOFT_MS = 2000
export const DEFAULT_HARD_MS = 5000

export function readFreezeNumberEnv(name, fallback) {
  const raw = process.env[name]
  if (raw == null || raw.trim() === '') {
    return fallback
  }
  const value = Number(raw)
  if (!Number.isFinite(value)) {
    throw new Error(`Invalid ${name}: expected a finite number, got ${JSON.stringify(raw)}`)
  }
  return value
}

export function extractTerminalHandle(result) {
  if (!result || typeof result !== 'object') {
    return null
  }
  const candidates = [
    result.handle,
    result.terminalHandle,
    result.agentTerminalHandle,
    typeof result.terminal === 'string' ? result.terminal : result.terminal?.handle,
    result.startupTerminal?.handle,
    result.tab?.terminal,
    result.tab?.handle
  ]
  for (const value of candidates) {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Set the env var to a plain integer of milliseconds (e.g. ORCA_FREEZE_SOFT_MS=2000).
  2. Strip any unit suffix or quotes in the provisioning script before exporting the var.
  3. If the value is optional, leave it unset rather than assigning an empty/garbage string so the fallback kicks in cleanly.

Example fix

# before
export ORCA_FREEZE_SOFT_MS="2000ms"

# after
export ORCA_FREEZE_SOFT_MS=2000
Defensive patterns

Strategy: validation

Validate before calling

function readMs(name, fallback) {
  const raw = process.env[name]
  if (raw == null || raw.trim() === '') return fallback
  const v = Number(raw)
  if (!Number.isFinite(v) || v < 0) {
    throw new Error(`${name}=${JSON.stringify(raw)} is not a finite non-negative number`)
  }
  return v
}

Type guard

const isFiniteNumber = (v) => typeof v === 'number' && Number.isFinite(v)

Prevention

When it happens

Trigger: Setting the env var to a non-numeric string (e.g. ORCA_FREEZE_SOFT_MS=abc), to a hex/empty-ish value, or to the literal 'Infinity' (Number('Infinity') === Infinity, which fails Number.isFinite). The blank case is handled earlier and returns the fallback.

Common situations: Operator typos in CI env files, trailing whitespace is handled by trim but a stray unit like '2000ms' is not, or a templated value that resolves to an empty placeholder string after a deploy. The soft/hard defaults (2000/5000 ms) only apply when the var is entirely absent.

Related errors


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