{"record":{"id":"85b0ac4c696ba225","repo":"cube-js/cube","slug":"unsupported-platform-process-platform","errorCode":null,"errorMessage":"Unsupported platform: ${process.platform}","messagePattern":"Unsupported platform: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-backend-shared/src/machine-id.ts","lineNumber":65,"sourceCode":"        .toLowerCase();\n    case 'win32':\n      return result\n        .toString()\n        .split('REG_SZ')[1]\n        .replace(/\\r+|\\n+|\\s+/ig, '')\n        .toLowerCase();\n    case 'linux':\n      return result\n        .toString()\n        .replace(/\\r+|\\n+|\\s+/ig, '')\n        .toLowerCase();\n    case 'freebsd':\n      return result\n        .toString()\n        .replace(/\\r+|\\n+|\\s+/ig, '')\n        .toLowerCase();\n    default:\n      throw new Error(`Unsupported platform: ${process.platform}`);\n  }\n}\n\nexport function machineIdSync(original: boolean = false): string {\n  if (process.platform in guid) {\n    const id: string = expose(\n      process.platform,\n      execSync(\n        guid[process.platform],\n        // Using pipe to protect unexpect STDERR output\n        { stdio: 'pipe' }\n      ).toString()\n    );\n    return original ? id : hash(id);\n  }\n\n  throw new Error(`Unsupported platform: ${process.platform}`);\n}","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-backend-shared/src/machine-id.ts#L47-L83","documentation":"machineId() resolves a unique machine identifier by running a platform-specific shell command (ioreg on macOS, REG.exe on Windows, /etc/machine-id on Linux, kenv/sysctl on FreeBSD). The expose() helper parses the command output per platform; if the platform is not one of these four, it throws this error because no machine-id strategy is implemented for it.","triggerScenarios":"Calling machineId() on a process.platform outside darwin/win32/linux/freebsd — e.g. running under Alpine is fine (linux), but AIX, Solaris, Android (may report 'android'), or exotic platforms hit the default branch. Also reachable indirectly via code that hashes machine ids for telemetry/instance identification.","commonSituations":"Running Cube on an unsupported Unix variant or inside a minimal container whose platform string is unusual; cross-compiling/deploying to ARM appliances with niche OSes; running tests on a platform not in the guid map.","solutions":["Run on a supported platform (darwin, win32, linux, freebsd) — e.g. use a standard Linux base image for containers","Provide your own identifier: set an env var like CUBEJS_INSTANCE_ID if the deployment machinery supports it, or patch/override the machine-id lookup in a fork","Check the reported process.platform value — some runtimes (e.g. under Termux/Android) report exotic platforms; use a normal Node.js build","File/upvote an issue to add support for the platform, supplying the equivalent command to fetch the machine UUID"],"exampleFix":"// before: running on unsupported OS\nconst id = await machineId();\n// after: guard on platform\nconst id = ['darwin','win32','linux','freebsd'].includes(process.platform) ? await machineId() : process.env.CUBEJS_INSTANCE_ID;","handlingStrategy":"validation","validationCode":"const SUPPORTED = ['darwin', 'win32', 'linux', 'freebsd'];\nif (!SUPPORTED.includes(process.platform)) {\n  throw new Error(`machineId() unsupported on ${process.platform}; provide a fallback instance id`);\n}\nconst id = await machineId();","typeGuard":"null","tryCatchPattern":"try {\n  const id = await machineId();\n} catch (e) {\n  if (e.message.startsWith('Unsupported platform')) {\n    const id = process.env.CUBEJS_INSTANCE_ID ?? require('os').hostname();\n  } else throw e;\n}","preventionTips":["Deploy only on darwin/win32/linux/freebsd platforms or standard Linux containers","Define a stable instance identifier (env var) as a fallback for exotic platforms","Log process.platform at startup in multi-platform environments to catch issues early","Keep Node.js builds standard; avoid runtimes that report unusual platform strings"],"tags":["platform","machine-id","unsupported-platform","environment"],"backgroundTag":"unsupported-platform","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}