{"record":{"id":"817a1c03de224dc7","repo":"stablyai/orca","slug":"unsupported-local-build-compatibility-architecture","errorCode":null,"errorMessage":"Unsupported local-build compatibility architecture: ${context.arch}","messagePattern":"Unsupported local-build compatibility architecture: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/electron-builder.config.cjs","lineNumber":227,"sourceCode":"      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      }\n      writeMacBuildCompatibility(resourcesDir, { version, commit, architecture })\n    }\n    prunePackagedRuntimeNodeModules(resourcesDir, context.electronPlatformName, context.arch)\n    verifyPackagedMainRuntimeDeps(resourcesDir)\n    // Why: boot the packaged daemon-entry under plain Node, but only for the\n    // slice matching the packaging host's arch — daemon-entry.js is JS, yet it","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/electron-builder.config.cjs#L209-L245","documentation":"On macOS afterPack, electron-builder's `context.arch` numeric enum is mapped via `{ 1: 'x64', 3: 'arm64' }` to determine the local-build compatibility architecture. Only x64 (1) and arm64 (3) are supported for writing the mac-build-compatibility metadata. If context.arch is 0 (ia32), 2 (armv7l), or 4 (universal), the mapping returns undefined and this error fires.","triggerScenarios":"Configuring electron-builder to build macOS for an architecture other than x64 or arm64 (e.g., adding 'armv7l' or ia32 to the mac.target arch list). Building a universal binary (context.arch === 4) which this compatibility-metadata path doesn't handle. Electron-builder changing its Arch enum values.","commonSituations":"Adding a new architecture target to the macOS build config. A change in electron-builder's Arch enum numbering. Attempting to build for an Intel 32-bit macOS target (not supported by modern Electron).","solutions":["Check the mac.target configuration in electron-builder.config.cjs:404 — the arch list should only contain 'x64' and 'arm64'.","If you need universal builds, extend the architectureByEnum map at line 224 to include `{ 4: 'universal' }` and handle the universal case in writeMacBuildCompatibility.","If you hit this unexpectedly, log `context.arch` to identify which enum value electron-builder is passing."],"exampleFix":"// before\nconst architectureByEnum = { 1: 'x64', 3: 'arm64' }\n\n// after — add universal support\nconst architectureByEnum = { 1: 'x64', 3: 'arm64', 4: 'universal' }","handlingStrategy":"validation","validationCode":"// Check arch before running afterPack\nfunction assertMacArch(archEnum) {\n  const supported = { 1: 'x64', 3: 'arm64' }\n  if (!supported[archEnum]) {\n    throw new Error(`macOS arch ${archEnum} not supported for compatibility metadata — use x64 (1) or arm64 (3)`)\n  }\n}","typeGuard":"function isSupportedMacArch(archEnum: number): archEnum is 1 | 3 {\n  return archEnum === 1 || archEnum === 3\n}","tryCatchPattern":null,"preventionTips":["Only build macOS for x64 and arm64 — the mac.target config at electron-builder.config.cjs:404 already restricts to these.","If adding universal builds, handle arch 4 before the compatibility metadata path.","Pin the electron-builder version to avoid Arch enum changes."],"tags":["electron-builder","macos","architecture","afterpack","packaging"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}