stablyai/orca · error · Error

npm_execpath is required; run this harness through pnpm

Error message

npm_execpath is required; run this harness through pnpm

What it means

Thrown at the top of run-ssh-docker-bulk-open-freeze-e2e.mjs because the harness shells out to pnpm (via process.env.npm_execpath) to run ensure:electron-runtime. pnpm sets npm_execpath to its CLI entry; bare node or npx does not. The guard prevents a half-initialized run where the electron runtime probe never executes.

Source

Thrown at config/scripts/run-ssh-docker-bulk-open-freeze-e2e.mjs:6

import { spawnSync } from 'node:child_process'

const extraArgs = process.argv.slice(2)
const pnpmEntry = process.env.npm_execpath
if (!pnpmEntry) {
  throw new Error('npm_execpath is required; run this harness through pnpm')
}
const env = {
  ...process.env,
  ORCA_E2E_SSH_DOCKER: '1'
}

const runtime = spawnSync(process.execPath, [pnpmEntry, 'run', 'ensure:electron-runtime'], {
  stdio: 'inherit',
  env
})

if (runtime.status !== 0) {
  process.exit(runtime.status ?? 1)
}

const result = spawnSync(
  process.execPath,
  [

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Invoke through pnpm: pnpm run test:e2e:ssh-docker-bulk-open-freeze (or the package.json script that wraps this harness).
  2. If you must invoke node directly for debugging, set npm_execpath first: export npm_execpath=$(pnpm which pnpm) — but prefer the pnpm task.
  3. Verify the calling CI step uses pnpm run, not npm run or a direct node call.

Example fix

// before
node config/scripts/run-ssh-docker-bulk-open-freeze-e2e.mjs
// after
pnpm run test:e2e:ssh-docker-bulk-open-freeze
Defensive patterns

Strategy: validation

Validate before calling

// assert the harness is being driven by pnpm
if (!process.env.npm_execpath || !process.env.npm_execpath.includes('pnpm')) {
  console.error('Run via pnpm: pnpm run test:e2e:ssh-docker-bulk-open-freeze')
  process.exit(1)
}

Type guard

function isPnpmEnv(env: NodeJS.ProcessEnv): boolean {
  return typeof env.npm_execpath === 'string' && /pnpm(\.cjs)?$/.test(env.npm_execpath)
}

Prevention

When it happens

Trigger: Executing the script directly with node config/scripts/run-ssh-docker-bulk-open-freeze-e2e.mjs, or via npm/yarn instead of pnpm, so npm_execpath is undefined.

Common situations: A developer runs node on the script during debugging; CI invokes it through a non-pnpm task runner; a shell wrapper stripped the npm_* env vars; pnpm was bypassed via npx.

Related errors


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