stablyai/orca · error · Error

Unsupported boundary: ${boundary}

Error message

Unsupported boundary: ${boundary}

What it means

Thrown inside runInternal() when the BOUNDARY_ENV environment variable (`ORCA_HANG_WATCHDOG_BENCH_BOUNDARY`) is neither 'child' nor 'worker'. This is a defensive belt for the boundary dispatch: the outer parseArgs already validates the value, but runInternal runs in a separately spawned Electron process that reads the boundary from env, so a corrupted/missing env value is caught here rather than silently measuring nothing.

Source

Thrown at config/scripts/hang-watchdog-memory-benchmark.mjs:271

async function runInternal() {
  if (process.platform !== 'darwin') {
    throw new Error('The production watchdog is macOS-only; run this benchmark on macOS')
  }
  const { app } = await import('electron')
  const boundary = process.env[BOUNDARY_ENV]
  const profileDir = mkdtempSync(path.join(tmpdir(), 'orca-watchdog-bench-'))
  app.setPath('userData', profileDir)
  try {
    await app.whenReady()
    const markerPath = path.join(profileDir, 'main-thread-hang.json')
    const result =
      boundary === 'child'
        ? await measureChild(markerPath)
        : boundary === 'worker'
          ? await measureWorker(markerPath)
          : (() => {
              throw new Error(`Unsupported boundary: ${boundary}`)
            })()
    process.stdout.write(`${RESULT_PREFIX}${JSON.stringify(result)}\n`)
  } finally {
    app.quit()
    rmSync(profileDir, { recursive: true, force: true })
  }
}

function parseArgs(argv) {
  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

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Run via the public CLI so parseArgs sets the env correctly: `--boundary child` or `--boundary worker`.
  2. If setting ORCA_HANG_WATCHDOG_BENCH_BOUNDARY manually, use exactly 'child' or 'worker'.
  3. When adding a new boundary type, update both the runInternal ternary and parseArgs allowlist.

Example fix

// before
ORCA_HANG_WATCHDOG_BENCH_BOUNDARY=process node ...  // throws
// after
ORCA_HANG_WATCHDOG_BENCH_BOUNDARY=child node ...
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_BOUNDARIES = new Set(['child', 'worker'])
const boundary = process.env.ORCA_HANG_WATCHDOG_BENCH_BOUNDARY
if (!SUPPORTED_BOUNDARIES.has(boundary ?? '')) {
  throw new Error(`boundary must be child or worker, got: ${boundary}`)
}

Type guard

const isSupportedBoundary = (v: unknown): v is 'child' | 'worker' => v === 'child' || v === 'worker'

Prevention

When it happens

Trigger: The spawned Electron child inherits a BOUNDARY_ENV value that is empty, misspelled, or set to an unsupported string (e.g. 'process', 'main'). Happens if the env is hand-edited between the launcher writing it and the child reading it, or if a new boundary type was added to parseArgs but not to this ternary.

Common situations: Manual debugging with a stale or typo'd env var, refactoring the boundary options without updating both parseArgs and runInternal, or env mangling through a shell wrapper.

Related errors


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