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 by the owner-settings selector benchmark when one of ORCA_OWNER_SETTINGS_BENCH_ROWS, BENCH_WRITES, or BENCH_WARMUP is set to a non-positive or non-integer value. The benchmark allocates fixture arrays sized by these, so zero/negative would produce degenerate arrays and NaN would corrupt timing.

Source

Thrown at config/scripts/repo-owner-settings-selector-benchmark.mjs:50

  const fields = block[1].match(/^\s{2}\w+\??:/gm) ?? []
  if (fields.length < 50) {
    throw new Error(`GlobalSettings parsed as only ${fields.length} fields; re-sync this benchmark`)
  }
  return fields.length
}

const SETTINGS_FIELDS = countGlobalSettingsFields(TYPES_SOURCE)
const ROWS = Number.parseInt(process.env.ORCA_OWNER_SETTINGS_BENCH_ROWS ?? '43', 10)
const WRITES = Number.parseInt(process.env.ORCA_OWNER_SETTINGS_BENCH_WRITES ?? '2000', 10)
const WARMUP = Number.parseInt(process.env.ORCA_OWNER_SETTINGS_BENCH_WARMUP ?? '200', 10)

for (const [name, value] of [
  ['ORCA_OWNER_SETTINGS_BENCH_ROWS', ROWS],
  ['ORCA_OWNER_SETTINGS_BENCH_WRITES', WRITES],
  ['ORCA_OWNER_SETTINGS_BENCH_WARMUP', WARMUP]
]) {
  if (!Number.isInteger(value) || value <= 0) {
    throw new Error(`${name} must be a positive integer, received ${value}`)
  }
}

function makeSettings() {
  const settings = { activeRuntimeEnvironmentId: 'focused-runtime' }
  for (let index = 0; index < SETTINGS_FIELDS - 1; index += 1) {
    settings[`field${index}`] = index % 3 === 0 ? `value-${index}` : index % 3 === 1 ? index : true
  }
  return settings
}

function makeRepos(rows) {
  return Array.from({ length: rows }, (_value, index) => ({
    id: `repo-${index}`,
    connectionId: null,
    executionHostId: `runtime:env-${index % 4}`
  }))
}

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Omit all three env vars to use the defaults (ROWS=43, WRITES=2000, WARMUP=200).
  2. Set each to a positive integer, e.g. ORCA_OWNER_SETTINGS_BENCH_WRITES=5000.

Example fix

// before
ORCA_OWNER_SETTINGS_BENCH_WRITES=0 node config/scripts/repo-owner-settings-selector-benchmark.mjs
// after
ORCA_OWNER_SETTINGS_BENCH_WRITES=5000 node config/scripts/repo-owner-settings-selector-benchmark.mjs
Defensive patterns

Strategy: validation

Validate before calling

function readPositiveInt(name, fallback) {
  const value = Number.parseInt(process.env[name] ?? String(fallback), 10)
  if (!Number.isInteger(value) || value <= 0) {
    throw new Error(`${name} must be a positive integer, received ${value}`)
  }
  return value
}

Type guard

function isPositiveInt(value) {
  return Number.isInteger(value) && value > 0
}

Prevention

When it happens

Trigger: Setting any of the three env vars to 0, a negative number, or a non-numeric string. Number.parseInt('abc', 10) yields NaN, and Number.isInteger(NaN) is false.

Common situations: A developer sets WRITES=0 to run a quick test, or passes a decimal like 2000.5 (parseInt truncates but the check still passes since 2000 is an integer — however a purely non-numeric string fails).

Related errors


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