decolua/9router · error · Error
Unsupported platform: ${platform}
Error message
Unsupported platform: ${platform} What it means
getDownloadUrl() maps the current OS (via os.platform()) to a cloudflared binary name in PLATFORM_MAPPINGS to build a GitHub download URL. If os.platform() returns an OS with no entry in the mapping (anything beyond the supported darwin/linux/win32 set), it throws 'Unsupported platform: <platform>'. This is a hard fail-fast so the tunnel never attempts to download/run a nonexistent binary.
Source
Thrown at src/lib/tunnel/cloudflare/cloudflared.js:49
x64: "cloudflared-linux-amd64",
arm64: "cloudflared-linux-arm64"
}
};
// Fallback order: prefer smallest/most-compatible binary per platform
const PLATFORM_FALLBACK = {
darwin: "cloudflared-darwin-amd64.tgz",
win32: "cloudflared-windows-386.exe",
linux: "cloudflared-linux-amd64"
};
function getDownloadUrl() {
const platform = os.platform();
const arch = os.arch();
const platformMapping = PLATFORM_MAPPINGS[platform];
if (!platformMapping) {
throw new Error(`Unsupported platform: ${platform}`);
}
const binaryName = platformMapping[arch] || PLATFORM_FALLBACK[platform];
return `${GITHUB_BASE_URL}/${binaryName}`;
}
// Download state — shared so status API can read it
const dlState = { downloading: false, progress: 0 };
export function getDownloadStatus() {
return { downloading: dlState.downloading, progress: dlState.progress };
}
function downloadFile(url, dest) {
return new Promise((resolve, reject) => {
const file = fs.createWriteStream(dest);
https.get(url, (response) => {View on GitHub (pinned to 90b52e06ff)
Solutions
- Run the gateway on a supported platform (darwin, linux, or win32).
- Manually install cloudflared and place the binary where the tunnel code expects it so download is skipped.
- Extend PLATFORM_MAPPINGS / PLATFORM_FALLBACK in src/lib/tunnel/cloudflare/cloudflared.js to cover your platform.
- Check `node -e "console.log(process.platform)"` to confirm what string your environment reports and verify it against the mapping.
Example fix
// before
const platformMapping = PLATFORM_MAPPINGS[platform];
if (!platformMapping) {
throw new Error(`Unsupported platform: ${platform}`);
}
// after
const platformMapping = PLATFORM_MAPPINGS[platform] || PLATFORM_FALLBACK[platform];
if (!platformMapping) {
throw new Error(`Unsupported platform: ${platform}`);
} Defensive patterns
Strategy: validation
Validate before calling
import os from "os";
const SUPPORTED = ["darwin", "linux", "win32"];
if (!SUPPORTED.includes(os.platform())) {
throw new Error(`Tunnel unsupported on this OS: ${os.platform()}`);
} Type guard
const isSupportedPlatform = (p) => typeof p === "string" && ["darwin","linux","win32"].includes(p);
Try / catch
try {
await enableTunnel(port);
} catch (e) {
if (e.message.startsWith("Unsupported platform:")) {
console.warn("Tunnel disabled: platform not supported");
return;
}
throw e;
} Prevention
- Gate tunnel features behind a platform check at app startup.
- Use process.platform in feature flags so UI hides tunnel toggles on unsupported OSes.
- Add tests asserting PLATFORM_MAPPINGS covers all values in a supported-platform list.
- If you must support BSD/Android, extend the mapping and verify the binary URL exists.
When it happens
Trigger: Calling enableTunnel() (which resolves the cloudflared download URL) on an OS whose process.platform is not one of the mapped keys, e.g. freebsd, openbsd, aix, or sunos. Also occurs in exotic environments like FreeBSD jails, Android/Termux (platform 'android'), or alpine musl builds if the mapping only lists 'linux' variants separately.
Common situations: Running the 9Router gateway on a NAS/BSD-based home server, in a Termux environment on Android, on an unsupported CI runner OS, or after a Node/OS change where the platform string differs from what the mapping table covers.
Related errors
- cancelled
- Health check timeout after ${HEALTH_CHECK.timeoutMs}ms
- tunnel cancelled
- [Tunnel] cloudflared exited unexpectedly, scheduling respawn
- [Tunnel] direct URL not reachable yet, continuing via public
AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30).
Data as JSON: /api/errors/d0b0421eebcc4264.
Report an issue: GitHub.