stablyai/orca · error

bin.orca target is not a file: ${binTarget}

Error message

bin.orca target is not a file: ${binTarget}

What it means

After confirming bin.orca is a non-empty string, the verifier statSyncs the resolved target and requires it to be a regular file (stats.isFile()). This catches the case where the bin path resolves to a directory, a symlink-to-directory, or a special file — anything that would crash or misbehave when the OS exec()s it. Note ENOENT surfaces as a thrown statSync error, not this message.

Source

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

 * compiled output tree that the packaged CLI loads at runtime.
 */
export function verifyPackageCliBin({
  projectDir = path.resolve(import.meta.dirname, '..', '..'),
  fixExecutable = false,
  fixPackageJson = false,
  runHelp = false
} = {}) {
  const packageJsonPath = path.join(projectDir, 'package.json')
  const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))
  const binTarget = packageJson.bin?.orca
  if (typeof binTarget !== 'string' || binTarget.length === 0) {
    throw new Error('package.json must declare bin.orca')
  }

  const binPath = path.resolve(projectDir, binTarget)
  const stats = statSync(binPath)
  if (!stats.isFile()) {
    throw new Error(`bin.orca target is not a file: ${binTarget}`)
  }
  if (stats.size === 0) {
    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'))

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Correct the bin.orca value in package.json to point at the actual compiled JS entry file.
  2. If the path is correct but the file is missing, run the build that emits it (the ENOENT would normally surface from statSync first — verify the build ran).
  3. Confirm no trailing slash or directory path leaked into the bin value.

Example fix

// before
"bin": { "orca": "out/cli" }
// after
"bin": { "orca": "out/cli/main.js" }
Defensive patterns

Strategy: validation

Validate before calling

import { statSync } from 'node:fs'
import path from 'node:path'
const binPath = path.resolve(projectDir, pkg.bin.orca)
const st = statSync(binPath)
if (!st.isFile()) throw new Error(`bin.orca target is not a regular file: ${binPath}`)

Type guard

import { statSync } from 'node:fs'
function isRegularFile(p: string): boolean {
  try { return statSync(p).isFile() } catch { return false }
}

Prevention

When it happens

Trigger: statSync(binPath).isFile() returns false at line 37. Happens when bin.orca points at a directory (e.g. `out/` instead of `out/cli/main.js`) or at a FIFO/socket/device.

Common situations: Pointing bin.orca at a folder by mistake during a build refactor; a stale path after the compiled layout changed; a symlink that resolves to a directory.

Related errors


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