{"record":{"id":"971ebb2dd016b51a","repo":"stablyai/orca","slug":"missing-packaged-resources-directory-resourcesd","errorCode":null,"errorMessage":"Missing packaged resources directory: ${resourcesDir}","messagePattern":"Missing packaged resources directory: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"config/electron-builder.config.cjs","lineNumber":221,"sourceCode":"  ],\n  afterPack: async (context) => {\n    // Why: a Linux runner-image glibc bump silently shipped a node-pty pty.node\n    // requiring GLIBC_2.34, crashing the app on startup on Ubuntu 20.04 (#9902).\n    // Fail packaging if any bundled native binary exceeds the supported floor.\n    if (context.electronPlatformName === 'linux') {\n      verifyLinuxGlibcFloor(context.appOutDir)\n    }\n    const resourcesDir =\n      context.electronPlatformName === 'darwin'\n        ? join(\n            context.appOutDir,\n            `${context.packager.appInfo.productFilename}.app`,\n            'Contents',\n            'Resources'\n          )\n        : join(context.appOutDir, 'resources')\n    if (!existsSync(resourcesDir)) {\n      throw new Error(`Missing packaged resources directory: ${resourcesDir}`)\n    }\n    if (context.electronPlatformName === 'darwin') {\n      const architectureByEnum = { 1: 'x64', 3: 'arm64' }\n      const architecture = architectureByEnum[context.arch]\n      if (!architecture) {\n        throw new Error(`Unsupported local-build compatibility architecture: ${context.arch}`)\n      }\n      const version = context.packager.appInfo.version\n      let commit = process.env.ORCA_BUILD_COMMIT || process.env.GITHUB_SHA || 'unknown'\n      if (commit === 'unknown') {\n        try {\n          commit = execFileSync('git', ['rev-parse', '--short=12', 'HEAD'], {\n            encoding: 'utf8'\n          }).trim()\n        } catch {\n          // Source archives can still produce a signed build with an explicit version.\n        }\n      }","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/electron-builder.config.cjs#L203-L239","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the appOutDir contents to see what was actually produced — the expected path is in the error message.","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.","Check electron-builder version compatibility — if you upgraded electron-builder, verify the output layout hasn't changed.","Ensure all extraResources `from` paths exist; a missing source can cause electron-builder to skip creating Resources."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify resources directory exists before afterPack dependencies run\nimport { existsSync } from 'fs'\nimport { join } from 'path'\nfunction assertResourcesDir(appOutDir, platform) {\n  const resourcesDir = platform === 'darwin'\n    ? join(appOutDir, 'Orca.app', 'Contents', 'Resources')\n    : join(appOutDir, 'resources')\n  if (!existsSync(resourcesDir)) {\n    throw new Error(`Resources dir missing: ${resourcesDir} — check electron-builder output`)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run electron-builder with `--dir` first to verify the output layout before full packaging.","Keep productName consistent across config — the .app name derives from productFilename.","Verify all extraResources `from` paths exist before packaging."],"tags":["electron-builder","packaging","afterpack","resources","filesystem"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}