stablyai/orca · error · Error
--trials must be a positive integer
Error message
--trials must be a positive integer
What it means
Thrown by parseArgs when options.trials is not an integer or is less than 1. The value is coerced via Number(value); non-numeric strings become NaN, and floats/zero/negatives are rejected. Trials drive how many times runTrial is invoked for median computation.
Source
Thrown at config/scripts/hang-watchdog-memory-benchmark.mjs:299
const options = { boundary: '', trials: DEFAULT_TRIALS, output: '' }
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index]
const value = argv[index + 1]
if (arg === '--boundary' || arg === '--trials' || arg === '--output') {
if (!value) {
throw new Error(`Missing value for ${arg}`)
}
options[arg.slice(2)] = arg === '--trials' ? Number(value) : value
index += 1
} else {
throw new Error(`Unknown argument: ${arg}`)
}
}
if (!['child', 'worker'].includes(options.boundary)) {
throw new Error('--boundary must be child or worker')
}
if (!Number.isInteger(options.trials) || options.trials < 1) {
throw new Error('--trials must be a positive integer')
}
return options
}
function electronPath() {
const requirePath = import.meta.resolve('electron')
const electronModulePath = fileURLToPath(requirePath)
return execFileSync(
process.execPath,
['-e', `process.stdout.write(require(${JSON.stringify(electronModulePath)}))`],
{
encoding: 'utf8'
}
)
}
function runTrial(executable, boundary) {
for (let attempt = 1; attempt <= MAX_LAUNCH_ATTEMPTS; attempt += 1) {View on GitHub (pinned to 1136503c6a)
Solutions
- Pass a positive integer: `--trials 7` (the default).
- Validate the variable feeding --trials in CI before invoking the script.
Example fix
// before node ... --boundary child --trials 3.5 // after node ... --boundary child --trials 4
Defensive patterns
Strategy: validation
Validate before calling
const trials = Number(options.trials)
if (!Number.isInteger(trials) || trials < 1) {
throw new Error(`--trials must be a positive integer, got: ${options.trials}`)
} Type guard
const isPositiveInteger = (v: unknown): v is number => typeof v === 'number' && Number.isInteger(v) && v >= 1
Prevention
- Validate CI variables feeding --trials before the script invocation.
- Remember the parser uses Number(), so floats and non-numerics are rejected.
When it happens
Trigger: Passing `--trials abc`, `--trials 3.5`, `--trials 0`, or `--trials -2`. Also fires on an empty string value.
Common situations: Typos, passing a trial count variable that resolved to empty in CI, or misunderstanding that the value must be a positive whole number.
Related errors
- Missing value for ${arg}
- Unknown argument: ${arg}
- --boundary must be child or worker
- Missing value for ${arg}
- Unknown argument: ${arg}
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/ea68df45f1ce57b9.
Report an issue: GitHub.