stablyai/orca · error · Error
ORCA_DOC_LINK_BENCH_ITERATIONS must be a positive integer, g
Error message
ORCA_DOC_LINK_BENCH_ITERATIONS must be a positive integer, got ${ITERATIONS} What it means
Thrown by the doc-link scan benchmark when ORCA_DOC_LINK_BENCH_ITERATIONS is not a safe positive integer. The value controls measured rounds of ProseMirror doc traversal across repo markdown files; warmup is clamped to min(9, ITERATIONS).
Source
Thrown at config/scripts/rich-markdown-doc-link-scan-benchmark.mjs:20
// Measures the complete ProseMirror doc traversal used by the two doc-link plugins.
import { execFileSync } from 'node:child_process'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import { performance } from 'node:perf_hooks'
import { fileURLToPath } from 'node:url'
import { Schema } from '@tiptap/pm/model'
import {
canHoldDocLink,
DOC_LINK_PATTERN,
isDocLinkLiteralCodeTextNode
} from '../../src/renderer/src/components/editor/rich-markdown-doc-link-scan.ts'
const REPO_ROOT = fileURLToPath(new URL('../..', import.meta.url))
const ITERATIONS = Number(process.env.ORCA_DOC_LINK_BENCH_ITERATIONS ?? '41')
const WARMUP_ITERATIONS = Math.min(9, ITERATIONS)
if (!Number.isSafeInteger(ITERATIONS) || ITERATIONS <= 0) {
throw new Error(`ORCA_DOC_LINK_BENCH_ITERATIONS must be a positive integer, got ${ITERATIONS}`)
}
const schema = new Schema({
nodes: {
doc: { content: 'paragraph+' },
paragraph: { content: 'text*' },
text: { group: 'inline' }
}
})
function walkUngated(doc) {
let matches = 0
let visited = 0
doc.descendants((node, _pos, parent) => {
visited += 1
if (node.type.name !== 'text' || !node.text || isDocLinkLiteralCodeTextNode(node, parent)) {
return
}View on GitHub (pinned to 1136503c6a)
Solutions
- Omit the env var to use the default of 41 iterations.
- Set it to a positive integer, e.g. ORCA_DOC_LINK_BENCH_ITERATIONS=100.
Example fix
// before ORCA_DOC_LINK_BENCH_ITERATIONS=0 node config/scripts/rich-markdown-doc-link-scan-benchmark.mjs // after ORCA_DOC_LINK_BENCH_ITERATIONS=100 node config/scripts/rich-markdown-doc-link-scan-benchmark.mjs
Defensive patterns
Strategy: validation
Validate before calling
const ITERATIONS = Number(process.env.ORCA_DOC_LINK_BENCH_ITERATIONS ?? '41')
if (!Number.isSafeInteger(ITERATIONS) || ITERATIONS <= 0) {
throw new Error(`ORCA_DOC_LINK_BENCH_ITERATIONS must be a positive integer, got ${ITERATIONS}`)
} Type guard
function isSafePositiveInt(value) {
return Number.isSafeInteger(value) && value > 0
} Prevention
- Use Number.isSafeInteger rather than Number.isInteger to reject Infinity and large floats.
- Default to a sensible round number (41 here) so most runs need no env var.
When it happens
Trigger: Setting ORCA_DOC_LINK_BENCH_ITERATIONS to 0, a negative number, a decimal, Infinity, or a non-numeric string. Number.isSafeInteger rejects all of these. The default is 41.
Common situations: A developer sets iterations to 0 for a dry run, or passes a large number exceeding Number.MAX_SAFE_INTEGER (rare).
Related errors
- ${name} must be a positive integer, received ${value}
- ORCA_ADVERTISED_URL_BENCH_ROUNDS must be even
- ${name} must be a positive integer, received ${value}
- ${name} must be a positive integer, received ${value}
- ORCA_REPLAY_BENCH_SECONDS must be positive, received ${SECON
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/901eb3ac969cdbe7.
Report an issue: GitHub.