abhigyanpatwari/GitNexus · error · Error

Local semantic embeddings are unavailable on macOS Intel (da

Error message

Local semantic embeddings are unavailable on macOS Intel (darwin/x64).
The bundled ONNX Runtime package (onnxruntime-node) does not ship a
darwin/x64 native binding, so the local embedding model cannot load here.
ONNX_WEB_BACKEND=wasm does not help: the failure happens while importing
the native runtime, before any backend can be selected. Forcing
GITNEXUS_EMBEDDING_DEVICE=wasm (or cpu) does not help either, for the same reason.

Use one of these instead:
  - Run analyze without --embeddings (all other indexing still works).
  - Point GITNEXUS_EMBEDDING_URL (with GITNEXUS_EMBEDDING_MODEL) at an
    OpenAI-compatible /v1/embeddings endpoint to embed over HTTP.
  - Run GitNexus on Linux or in Docker, where the native binding ships.
  - Run GitNexus on Apple Silicon (darwin/arm64), which ships a binding.
  - Use a future GitNexus build that restores darwin/x64 ONNX support.

What it means

Thrown by initEmbedder() when getLocalEmbeddingRuntimeBlocker() returns a non-null message, which happens exactly when process.platform==='darwin' && process.arch==='x64'. onnxruntime-node ships no darwin/x64 native binding, so importing transformers.js crashes with a raw 'Cannot find module ...onnxruntime_binding.node' before any device/backend selection can run. The blocker is checked before any native import so the user gets actionable guidance instead of a native crash; ONNX_WEB_BACKEND=wasm and GITNEXUS_EMBEDDING_DEVICE=wasm cannot help because the failure is at import time, not backend selection (#1515/#1516).

Source

Thrown at gitnexus/src/core/embeddings/embedder.ts:88

  config: Partial<EmbeddingConfig> = {},
  forceDevice?: 'dml' | 'cuda' | 'cpu' | 'wasm',
): Promise<FeatureExtractionPipeline> => {
  if (isHttpMode()) {
    throw new Error(
      'initEmbedder() should not be called in HTTP mode. ' +
        'Use embedText()/embedBatch() which handle HTTP transparently.',
    );
  }

  // Fail fast on platforms where the bundled native ONNX Runtime binding is not
  // shipped (macOS Intel, #1515). Must run before any transformers.js /
  // onnxruntime-node import or resolution — otherwise the native module load
  // crashes with a raw "Cannot find module ...onnxruntime_binding.node" that
  // ONNX_WEB_BACKEND=wasm cannot rescue (#1516). HTTP mode was already handled
  // above, so this only blocks the local-runtime path.
  const runtimeBlocker = getLocalEmbeddingRuntimeBlocker();
  if (runtimeBlocker) {
    throw new Error(runtimeBlocker);
  }

  // Return existing instance if available
  if (embedderInstance) {
    return embedderInstance;
  }

  // If already initializing, wait for that promise
  if (isInitializing && initPromise) {
    return initPromise;
  }

  isInitializing = true;

  const finalConfig = resolveEmbeddingConfig(config);
  // CUDA is probe-gated because ONNX Runtime can crash in native code when
  // provider libraries are missing. DirectML stays opt-in for the same reason.
  // Probe for CUDA first — ONNX Runtime crashes (uncatchable native error)

View on GitHub (pinned to d540b00184)

Solutions

  1. Run analyze without --embeddings — all other indexing still works.
  2. Point GITNEXUS_EMBEDDING_URL (with GITNEXUS_EMBEDDING_MODEL) at an OpenAI-compatible /v1/embeddings endpoint to embed over HTTP.
  3. Run GitNexus on Linux or in Docker, where the native binding ships.
  4. Run on Apple Silicon (darwin/arm64), which ships a darwin/arm64 binding.
  5. Use a future GitNexus build that restores darwin/x64 ONNX support.

Example fix

# before — fails on Intel Mac
$ npx gitnexus analyze --embeddings
# after — route embeddings over HTTP instead
$ export GITNEXUS_EMBEDDING_URL=https://api.openai.com/v1/embeddings
$ export GITNEXUS_EMBEDDING_MODEL=text-embedding-3-small
$ npx gitnexus analyze --embeddings
Defensive patterns

Strategy: validation

Validate before calling

import { getLocalEmbeddingRuntimeBlocker } from 'gitnexus/src/core/embeddings/runtime-support.js';
import { isHttpMode } from 'gitnexus/src/core/embeddings/http-client.js';
// Detect the macOS-Intel blocker before attempting local init.
const blocker = !isHttpMode() ? getLocalEmbeddingRuntimeBlocker() : null;
if (blocker) {
  console.error(blocker);
  process.exit(1);
}

Type guard

const isMacOsIntel = (): boolean =>
  process.platform === 'darwin' && process.arch === 'x64';
const localEmbeddingsSupported = (): boolean => !isMacOsIntel();

Prevention

When it happens

Trigger: Running `gitnexus analyze --embeddings` (or any path that calls initEmbedder) on an Intel Mac. HTTP mode is exempt — the guard runs only after the isHttpMode() early return, so setting GITNEXUS_EMBEDDING_URL bypasses this entirely.

Common situations: Developer on an Intel MacBook running local embeddings for the first time; CI on a macOS Intel GitHub Actions runner; trying ONNX_WEB_BACKEND=wasm or GITNEXUS_EMBEDDING_DEVICE=cpu/wasm in the hope of bypassing the native binding.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/e0c2d1fb75dbc812. Report an issue: GitHub.