stablyai/orca · error · AggregateError

Benchmark exact-command cleanup failed

Error message

Benchmark exact-command cleanup failed

What it means

killProcessMatchingCommand collects errors from two phases: killing each matching process, and a post-kill recheck for remaining matches. If two or more errors accumulate across these phases, they are wrapped in an AggregateError with this message. A single error is re-thrown as-is.

Source

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

      expectedCommandFragments
    )
    if (remaining.length > 0) {
      errors.push(
        new Error(
          `Benchmark helper cleanup left matching processes: ${remaining
            .map((identity) => identity.pid)
            .join(', ')}`
        )
      )
    }
  } catch (error) {
    errors.push(error)
  }
  if (errors.length === 1) {
    throw errors[0]
  }
  if (errors.length > 1) {
    throw new AggregateError(errors, 'Benchmark exact-command cleanup failed')
  }
  return true
}

function sleepSync(milliseconds) {
  Atomics.wait(sleepBuffer, 0, 0, milliseconds)
}

function validateDetachedIdentity(identity, expectedCommandFragment) {
  if (
    !Number.isInteger(identity?.pid) ||
    identity.pid <= 0 ||
    identity.pgid !== identity.pid ||
    typeof identity.command !== 'string' ||
    !identity.command.includes(expectedCommandFragment)
  ) {
    throw new Error('Recorded benchmark helper identity is invalid')
  }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Inspect AggregateError.errors array for individual failure reasons (EPERM, ESRCH, etc.)
  2. Run `ps -axo pid,pgid,command` and grep for the helper path to identify leftover processes
  3. Kill leftover processes manually with `kill -9 <pid>`
  4. Ensure trials clean up properly to avoid accumulation across runs

Example fix

// before: cleanup errors are opaque
try {
  killProcessMatchingCommand([helperPath])
} catch (e) {
  console.error(e.message) // 'Benchmark exact-command cleanup failed'
}

// after: inspect individual errors from the aggregate
try {
  killProcessMatchingCommand([helperPath])
} catch (e) {
  if (e instanceof AggregateError) {
    for (const sub of e.errors) console.error(sub.code, sub.message)
  }
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  killProcessMatchingCommand([helperPath])
} catch (error) {
  if (error instanceof AggregateError) {
    for (const sub of error.errors) {
      if (sub.code === 'ESRCH') continue // process already gone — benign
      console.error('Cleanup failure:', sub.code, sub.message)
    }
  } else if (error.code !== 'ESRCH') {
    throw error
  }
}

Prevention

When it happens

Trigger: Multiple helper processes match the command fragments, and killing several fails (e.g., EPERM on some, ESRCH on others); or the kill succeeds but the recheck ps call also fails. errors.length > 1 at line 95.

Common situations: Leftover helper processes from a previous crashed trial; processes owned by a different user (EPERM); zombies that cannot be signaled; ps during recheck fails due to buffer overflow with many processes.

Related errors


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