cube-js/cube · error · Error

Unsupported platform: ${process.platform}

Error message

Unsupported platform: ${process.platform}

What it means

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.

Source

Thrown at packages/cubejs-backend-shared/src/machine-id.ts:65

        .toLowerCase();
    case 'win32':
      return result
        .toString()
        .split('REG_SZ')[1]
        .replace(/\r+|\n+|\s+/ig, '')
        .toLowerCase();
    case 'linux':
      return result
        .toString()
        .replace(/\r+|\n+|\s+/ig, '')
        .toLowerCase();
    case 'freebsd':
      return result
        .toString()
        .replace(/\r+|\n+|\s+/ig, '')
        .toLowerCase();
    default:
      throw new Error(`Unsupported platform: ${process.platform}`);
  }
}

export function machineIdSync(original: boolean = false): string {
  if (process.platform in guid) {
    const id: string = expose(
      process.platform,
      execSync(
        guid[process.platform],
        // Using pipe to protect unexpect STDERR output
        { stdio: 'pipe' }
      ).toString()
    );
    return original ? id : hash(id);
  }

  throw new Error(`Unsupported platform: ${process.platform}`);
}

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Run on a supported platform (darwin, win32, linux, freebsd) — e.g. use a standard Linux base image for containers
  2. 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
  3. Check the reported process.platform value — some runtimes (e.g. under Termux/Android) report exotic platforms; use a normal Node.js build
  4. File/upvote an issue to add support for the platform, supplying the equivalent command to fetch the machine UUID

Example fix

// before: running on unsupported OS
const id = await machineId();
// after: guard on platform
const id = ['darwin','win32','linux','freebsd'].includes(process.platform) ? await machineId() : process.env.CUBEJS_INSTANCE_ID;
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = ['darwin', 'win32', 'linux', 'freebsd'];
if (!SUPPORTED.includes(process.platform)) {
  throw new Error(`machineId() unsupported on ${process.platform}; provide a fallback instance id`);
}
const id = await machineId();

Type guard

null

Try / catch

try {
  const id = await machineId();
} catch (e) {
  if (e.message.startsWith('Unsupported platform')) {
    const id = process.env.CUBEJS_INSTANCE_ID ?? require('os').hostname();
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/85b0ac4c696ba225. Report an issue: GitHub.