stablyai/orca · critical

Missing packaged resources directory: ${resourcesDir}

Error message

Missing packaged resources directory: ${resourcesDir}

What it means

In the electron-builder afterPack hook, the code computes the path to the packaged Resources directory (platform-specific: `Contents/Resources` inside the .app on macOS, `resources/` on Linux/Windows) and checks it with `existsSync`. If the directory doesn't exist, electron-builder's packaging step produced an unexpected output layout — the rest of afterPack (resource pruning, signing, verification) all depend on this directory existing.

Source

Thrown at config/electron-builder.config.cjs:221

  ],
  afterPack: async (context) => {
    // Why: a Linux runner-image glibc bump silently shipped a node-pty pty.node
    // requiring GLIBC_2.34, crashing the app on startup on Ubuntu 20.04 (#9902).
    // Fail packaging if any bundled native binary exceeds the supported floor.
    if (context.electronPlatformName === 'linux') {
      verifyLinuxGlibcFloor(context.appOutDir)
    }
    const resourcesDir =
      context.electronPlatformName === 'darwin'
        ? join(
            context.appOutDir,
            `${context.packager.appInfo.productFilename}.app`,
            'Contents',
            'Resources'
          )
        : join(context.appOutDir, 'resources')
    if (!existsSync(resourcesDir)) {
      throw new Error(`Missing packaged resources directory: ${resourcesDir}`)
    }
    if (context.electronPlatformName === 'darwin') {
      const architectureByEnum = { 1: 'x64', 3: 'arm64' }
      const architecture = architectureByEnum[context.arch]
      if (!architecture) {
        throw new Error(`Unsupported local-build compatibility architecture: ${context.arch}`)
      }
      const version = context.packager.appInfo.version
      let commit = process.env.ORCA_BUILD_COMMIT || process.env.GITHUB_SHA || 'unknown'
      if (commit === 'unknown') {
        try {
          commit = execFileSync('git', ['rev-parse', '--short=12', 'HEAD'], {
            encoding: 'utf8'
          }).trim()
        } catch {
          // Source archives can still produce a signed build with an explicit version.
        }
      }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Inspect the appOutDir contents to see what was actually produced — the expected path is in the error message.
  2. If on macOS, verify `context.packager.appInfo.productFilename` matches the actual .app directory name in appOutDir. Product name with spaces or special characters can cause mismatches.
  3. Check electron-builder version compatibility — if you upgraded electron-builder, verify the output layout hasn't changed.
  4. Ensure all extraResources `from` paths exist; a missing source can cause electron-builder to skip creating Resources.
Defensive patterns

Strategy: validation

Validate before calling

// Verify resources directory exists before afterPack dependencies run
import { existsSync } from 'fs'
import { join } from 'path'
function assertResourcesDir(appOutDir, platform) {
  const resourcesDir = platform === 'darwin'
    ? join(appOutDir, 'Orca.app', 'Contents', 'Resources')
    : join(appOutDir, 'resources')
  if (!existsSync(resourcesDir)) {
    throw new Error(`Resources dir missing: ${resourcesDir} — check electron-builder output`)
  }
}

Prevention

When it happens

Trigger: electron-builder's packaging step failed silently or produced output to a different directory than expected. The `productFilename` used to compute the macOS .app path doesn't match the actual .app name. Running afterPack in a context where electron-builder hasn't completed the pack step. A broken extraResources mapping that prevents Resources from being created.

Common situations: Mismatch between `productName`/`productFilename` in electron-builder config and the actual .app bundle name on disk. Upgrading electron-builder to a version that changed the output directory structure. Running the afterPack hook manually (outside electron-builder) for testing without the full pack output present.

Related errors


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