{"record":{"id":"af68c8c536762827","repo":"stablyai/orca","slug":"unsupported-boundary-boundary","errorCode":null,"errorMessage":"Unsupported boundary: ${boundary}","messagePattern":"Unsupported boundary: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/hang-watchdog-memory-benchmark.mjs","lineNumber":271,"sourceCode":"\nasync function runInternal() {\n  if (process.platform !== 'darwin') {\n    throw new Error('The production watchdog is macOS-only; run this benchmark on macOS')\n  }\n  const { app } = await import('electron')\n  const boundary = process.env[BOUNDARY_ENV]\n  const profileDir = mkdtempSync(path.join(tmpdir(), 'orca-watchdog-bench-'))\n  app.setPath('userData', profileDir)\n  try {\n    await app.whenReady()\n    const markerPath = path.join(profileDir, 'main-thread-hang.json')\n    const result =\n      boundary === 'child'\n        ? await measureChild(markerPath)\n        : boundary === 'worker'\n          ? await measureWorker(markerPath)\n          : (() => {\n              throw new Error(`Unsupported boundary: ${boundary}`)\n            })()\n    process.stdout.write(`${RESULT_PREFIX}${JSON.stringify(result)}\\n`)\n  } finally {\n    app.quit()\n    rmSync(profileDir, { recursive: true, force: true })\n  }\n}\n\nfunction parseArgs(argv) {\n  const options = { boundary: '', trials: DEFAULT_TRIALS, output: '' }\n  for (let index = 0; index < argv.length; index += 1) {\n    const arg = argv[index]\n    const value = argv[index + 1]\n    if (arg === '--boundary' || arg === '--trials' || arg === '--output') {\n      if (!value) {\n        throw new Error(`Missing value for ${arg}`)\n      }\n      options[arg.slice(2)] = arg === '--trials' ? Number(value) : value","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/hang-watchdog-memory-benchmark.mjs#L253-L289","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run via the public CLI so parseArgs sets the env correctly: `--boundary child` or `--boundary worker`.","If setting ORCA_HANG_WATCHDOG_BENCH_BOUNDARY manually, use exactly 'child' or 'worker'.","When adding a new boundary type, update both the runInternal ternary and parseArgs allowlist."],"exampleFix":"// before\nORCA_HANG_WATCHDOG_BENCH_BOUNDARY=process node ...  // throws\n// after\nORCA_HANG_WATCHDOG_BENCH_BOUNDARY=child node ...","handlingStrategy":"validation","validationCode":"const SUPPORTED_BOUNDARIES = new Set(['child', 'worker'])\nconst boundary = process.env.ORCA_HANG_WATCHDOG_BENCH_BOUNDARY\nif (!SUPPORTED_BOUNDARIES.has(boundary ?? '')) {\n  throw new Error(`boundary must be child or worker, got: ${boundary}`)\n}","typeGuard":"const isSupportedBoundary = (v: unknown): v is 'child' | 'worker' => v === 'child' || v === 'worker'","tryCatchPattern":null,"preventionTips":["Always set the boundary env via the CLI parser rather than hand-editing env vars.","When adding a new boundary, update the allowlist in both parseArgs and runInternal."],"tags":["benchmark","validation","boundary","env","watchdog"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}