stablyai/orca · error · AggregateError

Benchmark helper cleanup failed

Error message

Benchmark helper cleanup failed

What it means

killRecordedAndMatchingProcesses runs two independent cleanup steps — killRecordedProcess (by recorded identity) and killProcessMatchingCommand (by command fragment). Each is wrapped in its own try/catch. If BOTH throw, the errors are merged into an AggregateError so neither cleanup failure is hidden. A single failure rethrows the lone error.

Source

Thrown at config/scripts/macos-computer-helper-owner-loss-processes.mjs:416

  recordedCommandFragment,
  matchingCommandFragments
) {
  const errors = []
  try {
    killRecordedProcess(recordPath, recordedCommandFragment)
  } catch (error) {
    errors.push(error)
  }
  try {
    killProcessMatchingCommand(matchingCommandFragments)
  } catch (error) {
    errors.push(error)
  }
  if (errors.length === 1) {
    throw errors[0]
  }
  if (errors.length > 1) {
    throw new AggregateError(errors, 'Benchmark helper cleanup failed')
  }
}

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Inspect AggregateError.errors to see which cleanup path failed and why
  2. Ensure recordPath exists before calling (killRecordedProcess returns false for a missing file, so a missing record should not throw)
  3. Run killProcessMatchingCommand first to clear live helpers, then killRecordedProcess to clear the recorded one, so a stale record does not mask live cleanup
  4. If cleanup is best-effort, wrap the call and log rather than propagate

Example fix

// before
killRecordedAndMatchingProcesses(recordPath, frag, [frag])

// after
try {
  killRecordedAndMatchingProcesses(recordPath, frag, [frag])
} catch (error) {
  const causes = error instanceof AggregateError ? error.errors : [error]
  for (const cause of causes) console.warn('cleanup error:', cause)
}
Defensive patterns

Strategy: try-catch

Validate before calling

import { existsSync } from 'node:fs'
if (!existsSync(recordPath)) {
  // killRecordedProcess returns false; only sweep by command
  killProcessMatchingCommand(matchingCommandFragments)
}

Type guard

function isAggregateError(e) {
  return e instanceof Error && Array.isArray(e.errors)
}

Try / catch

try {
  killRecordedAndMatchingProcesses(recordPath, frag, matchingFrags)
} catch (error) {
  const causes = error instanceof AggregateError ? error.errors : [error]
  for (const c of causes) log.warn('cleanup failed:', c)
}

Prevention

When it happens

Trigger: killRecordedProcess(recordPath, recordedCommandFragment) throws AND killProcessMatchingCommand(matchingCommandFragments) throws in the same call.

Common situations: Stale record file whose recorded PID was recycled (144/145) while the command-fragment sweep also hits a uid-changed process (143/146); or a benchmark trial where the helper was never spawned, so both paths have nothing valid to kill and the recorded path errors on a malformed record.

Related errors


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