dmtrKovalenko/fff · error · Error

Unsupported architecture

Error message

Unsupported architecture: ${arch}

What it means

normalizeArch() converts process.arch to the Rust target arch segment and only accepts x64/amd64, arm64, and arm. Any other process.arch value makes getTriple() throw, so triple-based lookups (npm package name, library filename) cannot proceed.

Solutions

  1. Run on a supported architecture: x86_64 (x64/amd64), aarch64 (arm64), or arm.
  2. For other architectures, build the Rust crate from source (`cargo build --release -p fff-c`) and place the binary where the loader looks, bypassing npm-package resolution.
  3. Fix test mocks to set process.arch to 'x64' or 'arm64'.
Defensive patterns

Strategy: validation

Validate before calling

const OK = new Set(['x64','amd64','arm64','arm']);
if (!OK.has(process.arch)) throw new Error(`unsupported arch ${process.arch}`);

Type guard

function isSupportedArch(a: string): a is 'x64'|'amd64'|'arm64'|'arm' {
  return ['x64','amd64','arm64','arm'].includes(a);
}

Prevention

When it happens

Trigger: Calling getTriple() (via archName/normalizeArch) on hardware or an emulator where process.arch returns something like 'ia32', 'mips', 'ppc64', 's390x', 'riscv64', or 'loong64'.

Common situations: Running on older 32-bit x86 machines, big-iron or embedded Linux (s390x/ppc64), RISC-V boards, or under emulation layers that report an unusual arch; also broken test mocks of process.arch.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of dmtrKovalenko/fff@7f8537e70f (2026-09-10). Data as JSON: /api/errors/601e056f8274fb07. Report an issue: GitHub.

Appendix: source

Thrown at packages/fff-bun/src/platform.ts:66

    return "unknown-linux-musl";
  }
  return "unknown-linux-gnu";
}

/**
 * Normalize architecture name to Rust target format
 */
function normalizeArch(arch: string): string {
  switch (arch) {
    case "x64":
    case "amd64":
      return "x86_64";
    case "arm64":
      return "aarch64";
    case "arm":
      return "arm";
    default:
      throw new Error(`Unsupported architecture: ${arch}`);
  }
}

/**
 * Get the library file extension for the current platform
 */
export function getLibExtension(): "dylib" | "so" | "dll" {
  switch (process.platform) {
    case "darwin":
      return "dylib";
    case "win32":
      return "dll";
    default:
      return "so";
  }
}

/**

View on GitHub (pinned to 7f8537e70f)