{"record":{"id":"dec6f12b7f79a51e","repo":"affaan-m/ECC","slug":"unsupported-platform-platform","errorCode":null,"errorMessage":"Unsupported platform: ${platform}","messagePattern":"Unsupported platform: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/nasiko-release.js","lineNumber":33,"sourceCode":"const MAX_MANIFEST_BYTES = 1024 * 1024;\nconst MAX_ARCHIVE_BYTES = 100 * 1024 * 1024;\nconst MAX_BINARY_BYTES = 64 * 1024 * 1024;\nconst MAX_METADATA_BYTES = 64 * 1024;\nconst SHA256_PATTERN = /^sha256:[a-f0-9]{64}$/;\n\nconst QUALIFIED_RELEASES = Object.freeze({\n  'v0.1.0': Object.freeze({\n    'linux/amd64': Object.freeze({ manifestDigest: 'sha256:0df748a40f3d714b6b6a3376a1d13a224c05bdb8d1628f31ace5a7bee8ceb9de', binaryDigest: 'sha256:94a2bcab2d3832257e0111480bb7c3dcac81d63a7ae9bac53206a92c0957ee0f' }),\n    'linux/arm64': Object.freeze({ manifestDigest: 'sha256:655021a129c7df4621a80d16ea4eab38018530bfe9a20da646641d9f4ac5c249', binaryDigest: 'sha256:85f9fa5cfbed6c276fce6df2d71e9d0c66d7d8e8d46a40297464833d38db7a7e' }),\n    'darwin/amd64': Object.freeze({ manifestDigest: 'sha256:b4188482621efd7da5a2ab630f653665ab5f80b9aceae448b6bb5fc93e003f06', binaryDigest: 'sha256:ed6232e0bb96a2dcfd86d3c25f86021091600d52f09250403a54528bfe8100a3' }),\n    'darwin/arm64': Object.freeze({ manifestDigest: 'sha256:ce7e54fa19f989a5d125c4409b3587ca9503bb5a07bc5ff223c60e0fbad437f0', binaryDigest: 'sha256:3c60f862b04eea1b9a633593b39f1a443d9ca2123cf3edfd150d313e95f3894b' }),\n    'windows/amd64': Object.freeze({ manifestDigest: 'sha256:0760fe1fc98e8fedb66796aaf891a1de9268af1338c5e88b949656fda5d9f045', binaryDigest: 'sha256:0f57672d24fc3c70e4cbbf22864e65b35b9978ddaae3793803841536e682929b' }),\n  }),\n});\n\nfunction normalizePlatform(platform = process.platform, architecture = process.arch) {\n  const osName = platform === 'win32' ? 'windows' : platform;\n  if (!['linux', 'darwin', 'windows'].includes(osName)) throw new Error(`Unsupported platform: ${platform}`);\n  const arch = architecture === 'x64' ? 'amd64' : architecture;\n  if (!['amd64', 'arm64'].includes(arch)) throw new Error(`Unsupported architecture: ${architecture}`);\n  if (osName === 'windows' && arch !== 'amd64') throw new Error(`Unsupported architecture for Windows: ${architecture}`);\n  return { os: osName, arch, binaryName: osName === 'windows' ? 'nasiko.exe' : 'nasiko' };\n}\n\nfunction getQualifiedRelease(version, platform = process.platform, architecture = process.arch) {\n  if (!/^v\\d+\\.\\d+\\.\\d+$/.test(String(version || ''))) {\n    throw new Error('Nasiko installation requires a pinned version such as v0.1.0; latest is not allowed.');\n  }\n  const normalized = normalizePlatform(platform, architecture);\n  const qualification = QUALIFIED_RELEASES[version]?.[`${normalized.os}/${normalized.arch}`];\n  if (!qualification) throw new Error(`Nasiko ${version} is not qualified for ${normalized.os}/${normalized.arch}.`);\n  return { version, ...normalized, ...qualification, license: LICENSE, sourceUrl: SOURCE_URL };\n}\n\nfunction digestBytes(bytes) {\n  return `sha256:${crypto.createHash('sha256').update(bytes).digest('hex')}`;","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/affaan-m/ECC/blob/06c5e118c4d3e6c3b7f9445f973a2194c82de193/scripts/lib/nasiko-release.js#L15-L51","documentation":"normalizePlatform in scripts/lib/nasiko-release.js maps Node's 'win32' to 'windows' and only accepts 'linux', 'darwin', and 'windows' as operating systems. Any other process.platform value (for example 'freebsd', 'openbsd', 'sunos', 'aix', 'android', 'haiku') is rejected because no Nasiko binary has been qualified for it. The function backs getQualifiedRelease, so every install path hits this check.","triggerScenarios":"Calling getQualifiedRelease (or any install helper built on it) on a host where process.platform is not linux/darwin/win32, or explicitly passing platform: 'freebsd' and similar. Node on FreeBSD/OpenBSD jails, Solaris/AIX, or Android builds reporting 'android' all produce it.","commonSituations":"BSD-based CI runners or jails; legacy Solaris/AIX build servers; Termux/Android Node builds; hardcoding a platform string from a config that drifts from the supported matrix.","solutions":["Run the installer on linux, macOS, or Windows where qualified binaries exist","On an unsupported host, containerize the install (for example a linux container) or run under WSL","If you maintain the tool, add the platform to QUALIFIED_RELEASES with pinned digests after qualifying a build"],"exampleFix":"// before\nawait installNasiko({ version: 'v0.1.0' }); // throws on freebsd\n// after\nif (!['linux', 'darwin', 'win32'].includes(process.platform)) {\n  throw new Error(`Nasiko is not supported on ${process.platform}`);\n}\nawait installNasiko({ version: 'v0.1.0' });","handlingStrategy":"validation","validationCode":"const NASIKO_PLATFORMS = new Set(['linux', 'darwin', 'win32']);\nif (!NASIKO_PLATFORMS.has(process.platform)) {\n  throw new Error(`Nasiko install unsupported on ${process.platform}; skipping`);\n}","typeGuard":"type NasikoPlatform = 'linux' | 'darwin' | 'win32';\nconst isNasikoPlatform = (p: NodeJS.Platform): p is NasikoPlatform =>\n  p === 'linux' || p === 'darwin' || p === 'win32';","tryCatchPattern":"try {\n  await installNasiko({ version: 'v0.1.0' });\n} catch (error) {\n  if (/^Unsupported platform:/.test(String(error.message))) {\n    // Skip or select an alternative tool for this host; not retryable.\n  }\n  throw error;\n}","preventionTips":["Gate installer invocation behind a supported-platform matrix check in your bootstrap script","Assert `node -p process.platform` in CI matrices before adding the install step","Keep platform constants in one shared module so checks and calls cannot drift"],"tags":["platform","install","environment-check"],"backgroundTag":"unsupported-platform","analyzedSha":"06c5e118c4d3e6c3b7f9445f973a2194c82de193","analyzedAt":"2026-08-18T11:27:13.915Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}