{"record":{"id":"e1c7ef48e8ededba","repo":"can1357/oh-my-pi","slug":"unsupported-platform-plat-architecture","errorCode":null,"errorMessage":"Unsupported platform: ${plat}/${architecture}","messagePattern":"Unsupported platform: (.+?)/(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/utils/tools-manager.ts","lineNumber":231,"sourceCode":"\t\tthrow err;\n\t}\n}\n\n// Download and install a tool\nasync function downloadTool(tool: ToolName, signal?: AbortSignal): Promise<string> {\n\tconst config = TOOLS[tool];\n\tif (!config) throw new Error(`Unknown tool: ${tool}`);\n\n\tconst plat = os.platform();\n\tconst architecture = os.arch();\n\n\t// Get latest version\n\tconst version = await getLatestVersion(config.repo, signal);\n\n\t// Get asset name for this platform\n\tconst assetName = config.getAssetName(version, plat, architecture);\n\tif (!assetName) {\n\t\tthrow new Error(`Unsupported platform: ${plat}/${architecture}`);\n\t}\n\n\t// Create tools directory\n\tawait fs.promises.mkdir(TOOLS_DIR, { recursive: true });\n\n\tconst downloadUrl = `https://github.com/${config.repo}/releases/download/${config.tagPrefix}${version}/${assetName}`;\n\tconst binaryExt = plat === \"win32\" ? \".exe\" : \"\";\n\tconst binaryPath = path.join(TOOLS_DIR, config.binaryName + binaryExt);\n\n\t// Handle direct binary downloads (no archive extraction needed)\n\tif (config.isDirectBinary) {\n\t\tawait downloadFile(downloadUrl, binaryPath, signal);\n\t\tif (plat !== \"win32\") {\n\t\t\tawait fs.promises.chmod(binaryPath, 0o755);\n\t\t}\n\t\treturn binaryPath;\n\t}\n","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/utils/tools-manager.ts#L213-L249","documentation":"Each tool config exposes getAssetName(version, platform, arch) that maps the runtime OS/CPU to the upstream release asset filename, returning null when no asset exists for that combination. downloadTool() turns that null into this error naming the platform/arch pair, preventing a doomed 404 download.","triggerScenarios":"Running on an OS/architecture for which the tool's upstream releases publish no binary — e.g. freebsd, android, win32-arm64, linux-riscv64, or an arch (armv7) upstream doesn't ship.","commonSituations":"Running the agent on niche hardware (Raspberry Pi 32-bit, ARM Windows), inside Alpine/musl containers where upstream only publishes glibc assets that the mapping excludes, or emulated architectures in CI.","solutions":["Check the message's plat/arch against the tool's GitHub releases page to confirm no asset exists for your combination.","Build the tool from source and install it on PATH so the manager uses the system binary.","Run under a supported platform (x64/arm64 macOS, Linux, Windows) or a supported container image.","Contribute/extend getAssetName if upstream actually publishes an asset the mapping misses.","Use a qemu/rosetta emulation layer on a supported-arch host as a workaround."],"exampleFix":"// before: on linux/armv7 getAssetName returns null so the throw fires | // after: install via system package manager instead of auto-download, e.g. apt-get install -y ripgrep","handlingStrategy":"fallback","validationCode":"// check platform support before triggering download | const supported = new Set([\"darwin-arm64\", \"darwin-x64\", \"linux-x64\", \"linux-arm64\", \"win32-x64\"]); if (!supported.has(`${process.platform}-${process.arch}`)) console.warn(\"No prebuilt tool for this platform; use system binary\");","typeGuard":"function hasPrebuiltAsset(plat: string, arch: string): boolean { return [\"darwin\", \"linux\", \"win32\"].includes(plat) && [\"x64\", \"arm64\"].includes(arch); }","tryCatchPattern":"try { const p = await toolsManager.path(\"rg\"); } catch (err) { if (err.message.startsWith(\"Unsupported platform:\")) { /* use system-installed fallback, e.g. $which(\"rg\") */ } else throw err; }","preventionTips":["Ship a system-package-manager install path (apt/brew/winget) for unsupported platforms.","Gate auto-download on a supported-platform allowlist.","Test CI matrices on arm64 and x64 to catch mapping gaps.","Check the upstream releases page for the exact platform/arch before deploying to exotic hosts."],"tags":["platform","unsupported-environment","github-releases"],"backgroundTag":"unsupported-platform-arch","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}