can1357/oh-my-pi · error · Error

Unsupported platform

Error message

Unsupported platform: ${ctx.platformTag}\nSupported platforms: ${SUPPORTED_PLATFORMS.join(", ")}\nIf you need support for this platform, please open an issue.

What it means

The native loader only ships prebuilt addons for a fixed list of platform/arch tags (SUPPORTED_PLATFORMS). When the runtime's platform tag (os-arch combination, e.g. linux-arm64 or freebsd-x64) is not in that list, loading cannot possibly succeed, so the loader throws immediately with the list of supported platforms instead of accumulating per-candidate errors.

Solutions

  1. Run on one of the listed supported platforms (check the Supported platforms list in the message).
  2. Use an x64 or arm64 Linux/macOS build or Windows x64; for ARM SBCs use a 64-bit OS image.
  3. If your platform must be supported, open an issue as the message suggests (or build the Rust addon yourself via the pi-natives crate).
  4. Check for container/CI images that override the architecture (e.g. running amd64 image emulation — use a native-arch image).
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_PLATFORMS = ["darwin-x64", "darwin-arm64", "linux-x64", "linux-arm64", "win32-x64"]; // as shipped
const platformTag = `${process.platform}-${process.arch}`;
if (!SUPPORTED_PLATFORMS.includes(platformTag)) {
  // degrade gracefully: disable native-accelerated features or abort early with a clear message
  console.error(`Unsupported platform: ${platformTag}`);
}

Try / catch

try {
  loadNative(ctx);
} catch (err) {
  if (err.message.startsWith("Unsupported platform:")) {
    // fall back to non-native (JS) implementations or install-time check
  } else throw err;
}

Prevention

When it happens

Trigger: loadNative() runs on a machine whose ctx.platformTag (derived from process.platform/process.arch) is not in SUPPORTED_PLATFORMS — e.g. linux-armv7, freebsd, openbsd, android, sunos, or win32-ia32.

Common situations: Running omp on a Raspberry Pi / ARM SBC, BSD variants, unsupported Linux architectures (armv6/armv7, riscv), Alpine musl variants when only glibc targets ship, or cross-compiled containers with an unexpected 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 can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/81bca5142bb91726. Report an issue: GitHub.

Appendix: source

Thrown at packages/natives/native/loader-state.js:880

	const runtimeCandidates = prepended.length > 0 ? [...prepended, ...ctx.candidates] : ctx.candidates;

	for (const candidate of runtimeCandidates) {
		try {
			startupMarker(`native:require:${path.basename(candidate)}`);
			const bindings = require_(candidate);
			validateLoadedBindings(ctx, bindings, candidate);
			installNativeTokioRuntime(bindings);
	        cleanupStaleNativeVersions({ nativesDir: ctx.nativesDir, currentVersion: ctx.packageVersion });
			startupMarker("native:loadNative:done");
			return bindings;
		} catch (err) {
			const message = err instanceof Error ? err.message : String(err);
			errors.push(`${candidate}: ${message}`);
		}
	}

	if (!SUPPORTED_PLATFORMS.includes(ctx.platformTag)) {
		throw new Error(
			`Unsupported platform: ${ctx.platformTag}\n` +
				`Supported platforms: ${SUPPORTED_PLATFORMS.join(", ")}\n` +
				"If you need support for this platform, please open an issue.",
		);
	}
	const details = errors.map(error => `- ${error}`).join("\n");
	throw new Error(
		`Failed to load pi_natives native addon for ${ctx.addonLabel}.\n\nTried:\n${details}\n\n${buildHelpMessage(ctx)}`,
	);
}

View on GitHub (pinned to 9690622007)