cube-js/cube · error · Error
Unable to detect libc on not linux os
Error message
Unable to detect libc on not linux os
What it means
detectLibc() is a Linux-only helper that runs `getconf GNU_LIBC_VERSION` to determine whether the system uses glibc (e.g. Debian/Ubuntu) or musl (e.g. Alpine). It throws this error immediately when process.platform is not 'linux', because libc detection is meaningless on other operating systems. Callers like isNativeSupported, getTarget, and isCubeStoreSupported use it to pick native binaries (CubeStore), so it is only meant to be invoked on Linux.
Source
Thrown at packages/cubejs-backend-shared/src/platform.ts:8
import { spawnSync } from 'child_process';
import process from 'process';
import { internalExceptions } from './errors';
import { displayCLIWarning, displayCLIWarningOnce } from './cli';
export function detectLibc() {
if (process.platform !== 'linux') {
throw new Error('Unable to detect libc on not linux os');
}
try {
const { status } = spawnSync('getconf', ['GNU_LIBC_VERSION'], {
encoding: 'utf8',
// Using pipe to protect unexpect STDERR output
stdio: 'pipe'
});
if (status === 0) {
return 'gnu';
}
} catch (e: any) {
internalExceptions(e);
}
{
const { status, stdout, stderr } = spawnSync('ldd', ['--version'], {
encoding: 'utf8',View on GitHub (pinned to 7d981676b3)
Solutions
- Guard the call: only invoke detectLibc()/isNativeSupported()/isCubeStoreSupported() when process.platform === 'linux'.
- Use the higher-level platform helpers (isNativeSupported/getTarget) which branch on OS themselves instead of calling detectLibc directly.
- Run the code inside Linux (Docker container, Linux CI runner) if Linux-native behavior is required.
- Wrap in try/catch and fall back to a non-native (e.g. dockerized CubeStore) path when detection is unavailable.
Example fix
// before const supported = isCubeStoreSupported(); // after const supported = process.platform === 'linux' && isCubeStoreSupported();
Defensive patterns
Strategy: fallback
Validate before calling
// check platform before invoking Linux-only detection
if (process.platform !== 'linux') {
// skip native libc detection / use non-native path
} Type guard
const isLinux = (): boolean => process.platform === 'linux';
Try / catch
let supported = false;
try {
supported = isCubeStoreSupported();
} catch (e) {
if (e instanceof Error && e.message.includes('Unable to detect libc')) supported = false;
else throw e;
} Prevention
- Never call detectLibc() outside a process.platform === 'linux' branch.
- Prefer the higher-level isNativeSupported()/getTarget() helpers over direct libc detection.
- Test cross-platform scripts on macOS/Windows or in a Linux container.
- Design native-binary checks to fall back to dockerized/non-native modes.
When it happens
Trigger: Calling detectLibc() (directly or via isNativeSupported/getTarget/isCubeStoreSupported) while running on macOS, Windows, or another non-Linux platform; e.g. checking CubeStore native support inside a macOS dev script that assumes Linux.
Common situations: A cross-platform build or setup script calls Cube native-support checks on a developer's Mac or Windows machine; CI matrix accidentally runs a Linux-only detection step on a Windows runner; code written for a Linux deployment image is executed locally without a platform guard.
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
- Unsupported platform: ${process.platform}
- Lambda union with source data feature is supported only by e
- Only fixed rolling windows are supported by Cube Store but g
- You are using ${process.env} platform on arm64 with MUSL as
- You are using ${process.env} platform on arm64 which is not
AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02).
Data as JSON: /api/errors/68f3cd8c57c09780.
Report an issue: GitHub.