stablyai/orca · error · Error

${name} requires a positive integer.

Error message

${name} requires a positive integer.

What it means

Thrown by parsePositiveInt() in the apphang repro harness when --cycles or --output-lines is not a canonical positive integer string. The check is strict: Number.parseInt must succeed, the result must be > 0, and String(parsed) must exactly equal the input (rejecting leading zeros, whitespace, decimals, and suffixes).

Source

Thrown at config/scripts/repro-windows-apphang-terminal-activation.mjs:111

  node config/scripts/repro-windows-apphang-terminal-activation.mjs [options]

Options:
  --expect=none|repro|pass       none prints measurements, repro exits 0 only when hang evidence is observed,
                                 pass exits 1 if hang evidence is observed. Default: none.
  --gpu=on|off|auto[,mode...]    Terminal GPU setting(s) to run. Default: on.
  --cycles=N                     Activation/output cycles per GPU mode. Default: ${defaultCycles}.
  --output-lines=N               Lines emitted by each terminal stress command. Default: ${defaultOutputLines}.
  --report=PATH                  Write full JSON evidence to PATH and print a compact summary to stdout.
  --distro=NAME                  WSL distro to use. Default: first non docker-desktop distro.
  --no-source-control            Do not open Source Control during the stress loop.
  --no-dead-pty-reactivate       Do not kill PTYs and revisit workspaces after initial activation.
  --keep                         Keep disposable WSL/userData fixtures after the run.`)
}

function parsePositiveInt(name, value) {
  const parsed = Number.parseInt(value ?? '', 10)
  if (!Number.isInteger(parsed) || parsed <= 0 || String(parsed) !== value) {
    throw new Error(`${name} requires a positive integer.`)
  }
  return parsed
}

async function main() {
  if (process.platform !== 'win32') {
    throw new Error('This repro harness is intentionally Windows-only.')
  }
  const args = parseArgs()
  const distros = listWslDistros()
  const distro = args.distro ?? distros[0]
  if (!distro) {
    throw new Error('No user WSL distro found. Install/enable WSL or pass --distro=NAME.')
  }
  console.log(
    `[apphang-repro] issue=https://github.com/stablyai/orca/issues/6874 distro=${distro} gpuModes=${args.gpuModes.join(',')} cycles=${args.cycles}`
  )
  const fixture = createWslFixture(distro)

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Pass a plain positive integer with no padding or suffixes, e.g. --cycles=20.
  2. Use the defaults by omitting the flag (cycles=14, output-lines=1600).

Example fix

// before
node config/scripts/repro-windows-apphang-terminal-activation.mjs --cycles=08
// after
node config/scripts/repro-windows-apphang-terminal-activation.mjs --cycles=8
Defensive patterns

Strategy: validation

Validate before calling

function parsePositiveInt(name, value) {
  const parsed = Number.parseInt(value ?? '', 10)
  if (!Number.isInteger(parsed) || parsed <= 0 || String(parsed) !== value) {
    throw new Error(`${name} requires a positive integer.`)
  }
  return parsed
}

Type guard

function isCanonicalPositiveIntString(value) {
  if (typeof value !== 'string') return false
  const parsed = Number.parseInt(value, 10)
  return Number.isInteger(parsed) && parsed > 0 && String(parsed) === value
}

Prevention

When it happens

Trigger: Passing --cycles=0, --cycles=-5, --cycles=3.5, --cycles=08, --cycles=10abc, or --output-lines= (empty). The String(parsed) !== value guard catches non-canonical forms that parseInt would silently accept.

Common situations: A developer passes a padded value like 014, or appends a unit like 1000ms, or sets cycles to 0 to skip.

Related errors


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