stablyai/orca · error

compiled CLI package boundary is missing: ${path.relative(pr

Error message

compiled CLI package boundary is missing: ${path.relative(projectDir, outPackageJsonPath)}

What it means

The compiled CLI tree must carry an out/package.json that establishes the CommonJS module boundary the packaged CLI loads at runtime. When readFileSync throws ENOENT for out/package.json (and fixPackageJson was not set, since that flag writes it first), the verifier reports the missing boundary as a build defect rather than rethrowing the raw ENOENT. Without this file Node would resolve the out/ tree under the root package.json's module type, which can mismatch the compiled output.

Source

Thrown at config/scripts/verify-cli-bin.mjs:59

    throw new Error(`bin.orca target is empty: ${binTarget}`)
  }

  const content = readFileSync(binPath, 'utf8')
  if (!content.startsWith('#!/usr/bin/env node\n')) {
    throw new Error(`bin.orca target must start with a Node shebang: ${binTarget}`)
  }

  const outPackageJsonPath = path.join(projectDir, 'out', 'package.json')
  if (fixPackageJson) {
    mkdirSync(path.dirname(outPackageJsonPath), { recursive: true })
    writeFileSync(outPackageJsonPath, OUT_COMMONJS_PACKAGE_JSON, 'utf8')
  }
  let outPackageJson
  try {
    outPackageJson = JSON.parse(readFileSync(outPackageJsonPath, 'utf8'))
  } catch (error) {
    if (error && typeof error === 'object' && 'code' in error && error.code === 'ENOENT') {
      throw new Error(
        `compiled CLI package boundary is missing: ${path.relative(projectDir, outPackageJsonPath)}`
      )
    }
    throw error
  }
  if (outPackageJson.type !== 'commonjs') {
    throw new Error(
      `compiled CLI package boundary must declare type=commonjs: ${path.relative(
        projectDir,
        outPackageJsonPath
      )}`
    )
  }

  if (process.platform !== 'win32' && (stats.mode & 0o111) === 0) {
    if (!fixExecutable) {
      throw new Error(`bin.orca target is not executable: ${binTarget}`)
    }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Re-run verify-cli-bin with --fix-package-json to have it write the canonical CommonJS boundary file.
  2. Or ensure the build pipeline writes out/package.json with `{ "type": "commonjs", "private": true }`.
  3. Re-run without flags to confirm the file now exists and parses.

Example fix

# before
node config/scripts/verify-cli-bin.mjs
# after
node config/scripts/verify-cli-bin.mjs --fix-package-json
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs'
const outPkg = path.join(projectDir, 'out', 'package.json')
if (!existsSync(outPkg)) {
  // let the verifier fix it, or write the boundary yourself
  console.error('out/package.json missing — run verify-cli-bin --fix-package-json')
}

Try / catch

try {
  outPackageJson = JSON.parse(readFileSync(outPackageJsonPath, 'utf8'))
} catch (error) {
  if (error?.code === 'ENOENT') {
    // auto-fix instead of failing
    mkdirSync(path.dirname(outPackageJsonPath), { recursive: true })
    writeFileSync(outPackageJsonPath, OUT_COMMONJS_PACKAGE_JSON, 'utf8')
    outPackageJson = JSON.parse(readFileSync(outPackageJsonPath, 'utf8'))
  } else throw error
}

Prevention

When it happens

Trigger: JSON.parse(readFileSync('out/package.json')) throws an error with code === 'ENOENT' at line 58. Happens when the build never emitted out/package.json and --fix-package-json was not passed.

Common situations: Running verify-cli-bin without --fix-package-json on a fresh build that doesn't copy/write the boundary file; a build refactor that stopped emitting out/package.json.

Related errors


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