{"record":{"id":"ac5fd25519f3f819","repo":"Hmbown/CodeWhale","slug":"unsupported-platform-rawplatform-supported-platforms","errorCode":null,"errorMessage":"Unsupported platform: ${rawPlatform}. Supported platforms: ${supported}.\n\n${unsupportedBuildHint()}","messagePattern":"Unsupported platform: (.+?)\\. Supported platforms: (.+?)\\.\n\n(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"npm/codewhale/scripts/artifacts.js","lineNumber":76,"sourceCode":"    x64: [\"codewhale-windows-x64.exe\", \"codew-windows-x64.exe\", \"codewhale.bat\"],\n    arm64: [\"codewhale-windows-arm64.exe\", \"codew-windows-arm64.exe\"],\n  },\n};\n\n// HarmonyPC (openharmony) is an x86_64 Linux-compatible environment; map it to\n// the linux binary family so npm install succeeds without a separate build target.\nconst PLATFORM_ALIASES = {\n  openharmony: \"linux\",\n};\n\nfunction detectBinaryNames() {\n  const rawPlatform = os.platform();\n  const platform = PLATFORM_ALIASES[rawPlatform] || rawPlatform;\n  const arch = os.arch();\n  const defaults = ASSET_MATRIX[platform];\n  if (!defaults) {\n    const supported = Object.keys(ASSET_MATRIX).map(p => `'${p}'`).join(', ');\n    throw new Error(\n      `Unsupported platform: ${rawPlatform}. Supported platforms: ${supported}.\\n\\n` +\n      unsupportedBuildHint(),\n    );\n  }\n  const pair = defaults[arch];\n  if (!pair) {\n    const supported = Object.keys(defaults).map(a => `'${a}'`).join(', ');\n    const hint = platform === \"linux\" && arch === \"riscv64\" ? unsupportedRiscvHint() : unsupportedBuildHint();\n    throw new Error(\n      `Unsupported architecture: ${arch} on platform ${platform}. ` +\n      `Supported architectures: ${supported}.\\n\\n` +\n      hint,\n    );\n  }\n  return {\n    platform,\n    arch,\n    codewhale: pair[0],","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/npm/codewhale/scripts/artifacts.js#L58-L94","documentation":"`detectBinaryNames` maps `os.platform()` through PLATFORM_ALIASES and looks it up in ASSET_MATRIX to pick the native binary. If the current platform has no entry in ASSET_MATRIX, the installer cannot know which prebuilt artifact to use and throws this error, appending a hint on how to build from source (`unsupportedBuildHint()`).","triggerScenarios":"Running the npm install/postinstall for codewhale or codew on an `os.platform()` value (e.g. 'freebsd', 'openbsd', 'aix', 'sunos') that has no key in ASSET_MATRIX, and no alias maps it to a supported platform.","commonSituations":"CI on a niche OS image; running on FreeBSD/OpenBSD workstations; a new OS release renaming the platform string; Docker images based on unsupported systems.","solutions":["Switch to a supported platform listed in the error message (darwin, linux, win32, etc.).","Follow the `unsupportedBuildHint()` output to build the binary from source and install it manually.","Set CODEWHALE_RELEASE_BASE_URL / supply a prebuilt binary for your platform if your distribution provides one."],"exampleFix":"// before (postinstall auto-detection fails on FreeBSD)\nnpm install -g codewhale\n// after\n Unsupported platform: build from source per unsupportedBuildHint(), e.g.:\ngit clone <repo> && cargo build --release -p codewhale-cli && cp target/release/codewhale ~/.local/bin/","handlingStrategy":"fallback","validationCode":"const supported = ['darwin','linux','win32'];\nif (!supported.includes(os.platform())) {\n  console.warn('Unsupported platform; build from source instead of npm install.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await install();\n} catch (err) {\n  if (String(err.message).startsWith('Unsupported platform:')) {\n    await buildFromSource(); // per unsupportedBuildHint()\n  } else throw err;\n}","preventionTips":["Check `os.platform()` against the supported list before installing on unusual OSes.","Use standard CI images (ubuntu, macos, windows).","Read unsupportedBuildHint() output — it contains the exact source-build steps."],"tags":["npm","installer","platform-detection","unsupported-platform"],"backgroundTag":"unsupported-platform","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}