stablyai/orca · error

Unsupported packaged runtime architecture: ${String(electron

Error message

Unsupported packaged runtime architecture: ${String(electronArch)}

What it means

The `normalizeElectronArchitecture` function converts the electron-builder arch value (either a numeric Arch enum or a string) to a normalized name and checks it against PACKAGED_NATIVE_ARCHITECTURES ({ia32, x64, arm, arm64}). If the normalized value isn't in that set — e.g., 'universal' (enum 4), undefined (unknown enum), or an unrecognized string — the build fails. This guards all architecture-dependent packaging steps (node-pty pruning, parcel-watcher pruning).

Source

Thrown at config/packaged-runtime-node-modules.cjs:272

}

function normalizeNodePtyWindowsArch(electronArch) {
  const architecture = normalizeElectronArchitecture(electronArch)
  if (architecture !== 'x64' && architecture !== 'arm64') {
    throw new Error(`Unsupported packaged node-pty Windows architecture: ${architecture}`)
  }
  return architecture
}

function normalizeElectronArchitecture(electronArch) {
  const architecture =
    typeof electronArch === 'number'
      ? ELECTRON_ARCHITECTURE_BY_ENUM[electronArch]
      : electronArch === 'armv7l'
        ? 'arm'
        : electronArch
  if (!PACKAGED_NATIVE_ARCHITECTURES.has(architecture)) {
    throw new Error(`Unsupported packaged runtime architecture: ${String(electronArch)}`)
  }
  return architecture
}

function pruneNodePtyNativeDirectories(directory, platformPrefix, electronArch, allowsSuffix) {
  if (!existsSync(directory)) {
    return
  }
  const architecture = normalizeElectronArchitecture(electronArch)
  const targetPrefix = `${platformPrefix}${architecture}`
  const platformPrefixes = Object.values(NODE_PTY_PREBUILD_PREFIX_BY_PLATFORM)
  for (const entry of readdirSync(directory, { withFileTypes: true })) {
    if (!entry.isDirectory() || !platformPrefixes.some((prefix) => entry.name.startsWith(prefix))) {
      continue
    }
    const matchesTarget =
      entry.name.startsWith(platformPrefix) &&
      (entry.name === targetPrefix || (allowsSuffix && entry.name.startsWith(`${targetPrefix}-`)))

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Check what `electronArch` value is being passed — log it at the call site. If it's a number, cross-reference ELECTRON_ARCHITECTURE_BY_ENUM at line 47.
  2. If building universal, the pruning functions need to handle 'universal' specially (run for each slice) rather than passing it to normalizeElectronArchitecture — see how electron-builder.config.cjs:251 handles `context.arch === 4` for boot verification.
  3. If you added a new architecture, add it to both ELECTRON_ARCHITECTURE_BY_ENUM and PACKAGED_NATIVE_ARCHITECTURES.
  4. For unrecognized string archs, add the alias mapping at line 268-270.

Example fix

// before — universal arch fails
PACKAGED_NATIVE_ARCHITECTURES = new Set(['ia32', 'x64', 'arm', 'arm64'])
// context.arch === 4 → 'universal' → not in set → throws

// after — handle universal by iterating slices
if (architecture === 'universal') {
  normalizeElectronArchitecture('x64')
  normalizeElectronArchitecture('arm64')
  return
}
Defensive patterns

Strategy: validation

Validate before calling

// Verify arch is in the supported set before pruning native modules
const PACKAGED_NATIVE_ARCHITECTURES = new Set(['ia32', 'x64', 'arm', 'arm64'])
function assertSupportedRuntimeArch(electronArch) {
  const map = { 0: 'ia32', 1: 'x64', 2: 'arm', 3: 'arm64', 4: 'universal' }
  let arch = typeof electronArch === 'number' ? map[electronArch] : electronArch
  if (arch === 'armv7l') arch = 'arm'
  if (!PACKAGED_NATIVE_ARCHITECTURES.has(arch)) {
    throw new Error(`Unsupported arch: ${String(electronArch)} (normalized: ${arch})`)
  }
}

Type guard

function isSupportedRuntimeArch(arch: string): arch is 'ia32' | 'x64' | 'arm' | 'arm64' {
  return ['ia32', 'x64', 'arm', 'arm64'].includes(arch)
}

Prevention

When it happens

Trigger: Building for 'universal' (context.arch === 4) — universal is not in PACKAGED_NATIVE_ARCHITECTURES because pruning needs a concrete arch, not a merged one. An unrecognized arch string passed to the packaging step. A future Electron arch enum value not in ELECTRON_ARCHITECTURE_BY_ENUM (which maps 0-4), resulting in undefined.

Common situations: Configuring a universal macOS build that triggers the pruning path. Electron-builder passing an unexpected arch value. Adding a new architecture (e.g., riscv64) without updating the supported set. The armv7l string alias (mapped to 'arm' at line 269) working, but other strings not being handled.

Related errors


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