stablyai/orca · error · Error

Could not read helper socket path from command: ${command}

Error message

Could not read helper socket path from command: ${command}

What it means

socketPathFromCommand extracts the helper's unix socket path from its command line using the regex / --agent (.+?) --token-file /. It throws when the regex does not match, meaning the helper was not launched with the expected --agent <socket> --token-file <file> argument shape, so the socket path cannot be derived for an invalid-peer connection test.

Source

Thrown at config/scripts/macos-computer-helper-owner-loss-benchmark.mjs:184

      if (
        match &&
        Number(match[2]) === sidecarPid &&
        Number(match[3]) === Number(match[1]) &&
        match[4].includes(helperPath) &&
        match[4].includes(' --agent ')
      ) {
        return { pid: Number(match[1]), pgid: Number(match[3]), command: match[4] }
      }
    }
    await sleep(50)
  }
  throw new Error(`Could not find helper owned by sidecar ${sidecarPid}`)
}

function socketPathFromCommand(command) {
  const match = command.match(/ --agent (.+?) --token-file /)
  if (!match) {
    throw new Error(`Could not read helper socket path from command: ${command}`)
  }
  return match[1]
}

function connectInvalidPeer(socketPath) {
  return new Promise((resolve, reject) => {
    const socket = net.createConnection(socketPath)
    let accepted = false
    const timeout = setTimeout(() => {
      socket.destroy()
      reject(new Error('Invalid-peer connection timed out'))
    }, 5_000)
    let buffer = ''
    const cleanup = () => {
      clearTimeout(timeout)
      socket.off('error', onError)
      socket.off('data', onData)
    }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Log the command string passed in and confirm both --agent and --token-file are present and in that order.
  2. If the helper renamed the flag, update the regex to the new argument shape.
  3. When reading the command from ps, request the full command line (ps -o command= or ww) so it is not truncated.

Example fix

// before
const match = command.match(/ --agent (.+?) --token-file /)
if (!match) throw new Error(`Could not read helper socket path from command: ${command}`)

// after
const match = command.match(/ --agent (.+?) --token-file /)
if (!match) {
  throw new Error(`Could not read helper socket path from command: ${command.slice(0, 300)}`)
}
Defensive patterns

Strategy: validation

Validate before calling

function parseSocketPath(command) {
  const m = command.match(/ --agent (.+?) --token-file /)
  if (!m) throw new Error(`helper command missing --agent/--token-file: ${command.slice(0,300)}`)
  return m[1]
}

Type guard

const hasSocketFlags = (cmd) => / --agent .+? --token-file /.test(cmd)

Prevention

When it happens

Trigger: The helper command line changed argument order or names (e.g. --socket instead of --agent), the --token-file flag is absent, or socketPathFromCommand was handed a truncated/wrong command string.

Common situations: A helper version that renamed its flags, a launch wrapper that reorders argv, or capturing only part of the command line from ps so the two-flag pattern is split across the cut.

Related errors


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