JuliusBrussee/caveman · error

OFF_STATES.unsupportedPlatform(os, arch).line

Error message

OFF_STATES.unsupportedPlatform(os, arch).line

What it means

setupPlatform maps the current OS/architecture to release binaries and only supports darwin/linux/win32 on arm64/amd64 (x64 is normalized to amd64). Anything else — e.g. freebsd, alpine-mips, or 32-bit x86 — throws the OFF_STATES.unsupportedPlatform message.

Solutions

  1. Run on a supported platform: darwin/linux/win32 with arm64 or amd64 hardware.
  2. Use a 64-bit OS image (x64/arm64) instead of a 32-bit one.
  3. Build/install the binaries manually from source if your platform is not in the release matrix.

Example fix

// before (32-bit container)
$ cave setup
Error: unsupported platform linux/ia32

// after
# use a 64-bit image
docker run --platform linux/amd64 -it ... cave setup
Defensive patterns

Strategy: fallback

Validate before calling

const okOs = ['darwin', 'linux', 'win32'].includes(process.platform);
const arch = process.arch === 'x64' ? 'amd64' : process.arch;
const okArch = ['arm64', 'amd64'].includes(arch);
if (!okOs || !okArch) console.warn(`unsupported platform ${process.platform}/${arch}; use darwin/linux/win32 on arm64/amd64`);

Type guard

const isSupportedPlatform = (os: NodeJS.Platform, arch: string): boolean =>
  ['darwin', 'linux', 'win32'].includes(os) && ['arm64', 'amd64'].includes(arch === 'x64' ? 'amd64' : arch);

Try / catch

try {
  setupPlatform();
} catch (error) {
  console.error(`${error.message}\nBuild binaries from source or run on a supported platform.`);
  process.exit(1);
}

Prevention

When it happens

Trigger: Running setup on an unsupported platform: linux with arch 'arm'/'ia32', win32 on arm (pre-nodeArch arm64 handling), FreeBSD/OpenBSD, or process.arch values like 'ppc64' or 's390x'.

Common situations: Running in unusual CI containers (linux/386), on Raspberry Pi 32-bit OS, or inside emulation where Node reports a non-standard 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 JuliusBrussee/caveman@3ee70a1026 (2026-09-20). Data as JSON: /api/errors/051df1f8620abb92. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/index.ts:2220

const INSTALL_BINARIES = GO_BINARIES.map((binary) => binary.name);

function setupTimeoutSeconds(): number {
  const raw = process.env.CAVE_SETUP_TIMEOUT ?? "300";
  const parsed = Number(raw);
  if (!Number.isInteger(parsed) || parsed <= 0) {
    throw new Error(`CAVE_SETUP_TIMEOUT must be a positive integer (got ${JSON.stringify(raw)})`);
  }
  return parsed;
}

export function setupPlatform(
  os: NodeJS.Platform = process.platform,
  nodeArch: string = process.arch,
): { os: string; arch: string } {
  const arch = nodeArch === "x64" ? "amd64" : nodeArch;
  if (!(os === "darwin" || os === "linux" || os === "win32") ||
      !(arch === "arm64" || arch === "amd64")) {
    throw new Error(OFF_STATES.unsupportedPlatform(os, arch).line);
  }
  return { os, arch };
}

export function binaryInstallFilename(name: string, os: string = process.platform): string {
  return os === "win32" ? `${name}.exe` : name;
}

function binaryInstallManifestPath(): string {
  return join(cavemanHome(), "bin", ".bin-manifest.json");
}

function sha256File(path: string): string | null {
  try {
    return createHash("sha256").update(readFileSync(path)).digest("hex");
  } catch {
    return null;
  }

View on GitHub (pinned to 3ee70a1026)