stablyai/orca · error · Error

Could not read physical footprint for PIDs ${pids.join(', ')

Error message

Could not read physical footprint for PIDs ${pids.join(', ')}

What it means

Thrown by physicalFootprintBytes() when `/usr/bin/footprint` runs successfully but its output does not match the expected regex, so no byte count could be parsed. For a single PID it matches `<line> Footprint: <n> B`; for multiple PIDs it matches `Summary Footprint: <n> B`. A null parse result triggers the throw.

Source

Thrown at config/scripts/hang-watchdog-process-metrics.mjs:53

export function parsePhysicalFootprintBytes(output, processCount) {
  const match =
    processCount > 1
      ? output.match(/^Summary Footprint:\s+(\d+) B$/m)
      : output.match(/^[^\s].*\sFootprint:\s+(\d+) B/m)
  const bytes = Number(match?.[1])
  return Number.isFinite(bytes) && bytes > 0 ? bytes : null
}

export function physicalFootprintBytes(pids) {
  const pidArgs = pids.flatMap((pid) => ['--pid', String(pid)])
  const output = execFileSync(
    '/usr/bin/footprint',
    [...pidArgs, '--format', 'bytes', '--noCategories'],
    { encoding: 'utf8' }
  )
  const bytes = parsePhysicalFootprintBytes(output, pids.length)
  if (bytes === null) {
    throw new Error(`Could not read physical footprint for PIDs ${pids.join(', ')}`)
  }
  return bytes
}

export function parseProcessCpuTimeMs(raw) {
  if (!raw.trim()) {
    return null
  }
  const parts = raw.split(':').map(Number)
  if (!parts.length || parts.some((part) => !Number.isFinite(part))) {
    return null
  }
  const seconds = parts.reduce((total, part) => total * 60 + part, 0)
  const milliseconds = seconds * 1_000
  return milliseconds >= 0 ? milliseconds : null
}

function processCpuTimeMs(pid) {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Confirm all PIDs are alive before calling physicalFootprintBytes.
  2. Run `/usr/bin/footprint --pid <pid> --format bytes --noCategories` manually to inspect the actual output format.
  3. If the macOS footprint format changed, update parsePhysicalFootprintBytes regex to match.
  4. Gate the benchmark on a tested macOS version range.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm all PIDs are alive and footprint exists before reading
import { existsSync } from 'node:fs'
if (!existsSync('/usr/bin/footprint')) throw new Error('/usr/bin/footprint not found (macOS only)')
for (const pid of pids) { try { process.kill(pid, 0) } catch { throw new Error(`pid ${pid} not alive for footprint`) } }

Prevention

When it happens

Trigger: One or more PIDs exited before footprint ran, the macOS footprint tool changed its output format across OS versions, or footprint emitted a category/summary layout the regex does not cover.

Common situations: Child process exiting mid-measurement, running on a newer/older macOS where footprint output differs, or passing already-dead PIDs.

Related errors


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