abhigyanpatwari/GitNexus · error
No suitable device found for embedding model
Error message
No suitable device found for embedding model
What it means
initLocalEmbedder throws this after exhausting every candidate device (e.g. webgpu/cuda/dml then cpu): each attempt failed with its own deviceError, and the last attempt's error was re-thrown before reaching this line only if it was not the final device. Reaching this throw means the devicesToTry loop somehow ended without a successful pipeline and without the last device re-throwing — an exhaustion fallback indicating no execution provider could run the embedding model.
Solutions
- Reinstall the runtime: `gitnexus embeddings install --force` (or a clean reinstall) to repair a corrupted onnxruntime.
- Run `gitnexus doctor` to check the embedding runtime and device status.
- Try explicitly setting GITNEXUS_EMBEDDING_DEVICE=cpu to skip GPU attempts and see the underlying CPU error.
- If the CPU lacks required instructions or onnxruntime cannot load at all, switch to GITNEXUS_EMBEDDING_URL HTTP embedding.
- Inspect the deviceError logged during the loop for the root cause of each failed device.
Example fix
// before: every device fails, root cause hidden const embedder = await initLocalEmbedder(); // after (shell): isolate the CPU failure and repair the runtime GITNEXUS_EMBEDDING_DEVICE=cpu node -e "...initLocalEmbedder()" # see real deviceError gitnexus embeddings install --force
Defensive patterns
Strategy: try-catch
Validate before calling
import { assessLocalEmbeddingRuntime } from 'gitnexus/src/core/embeddings/runtime-support.js';
if (assessLocalEmbeddingRuntime().status !== 'ready') {
throw new Error('Embedding runtime not ready; run gitnexus doctor / embeddings install');
} Try / catch
try {
await initLocalEmbedder();
} catch (err) {
if (err.message === 'No suitable device found for embedding model') {
// reinstall runtime with --force, retry with GITNEXUS_EMBEDDING_DEVICE=cpu, or use HTTP embedding
}
} Prevention
- Run `gitnexus doctor` to verify device/runtime health before embedding jobs
- Repair interrupted installs with `gitnexus embeddings install --force`
- Force GITNEXUS_EMBEDDING_DEVICE=cpu in containers lacking GPU drivers
- Fall back to HTTP embedding when no execution provider is viable
When it happens
Trigger: Calling initLocalEmbedder() when pipeline creation fails on every device in devicesToTry — e.g. broken/corrupted onnxruntime-node install, GPU drivers missing while forced device was expected to fall back, or an ONNX build incompatible with the CPU.
Common situations: Damaged embedding-runtime prefix (interrupted install); containers without GPU drivers where non-CPU devices fail and CPU also fails due to a bad onnxruntime build; very old CPUs lacking required instruction sets.
Related errors
- No suitable device found for embedding model
- runtimeBlocker (local embedding runtime blocker message)
- runtimeBlocker (local embedding runtime blocker message)
- assessment.message (local embedding runtime…
- Could not install the embedding runtime
AI-assisted analysis of abhigyanpatwari/GitNexus@ac9a4e9abd (2026-09-15).
Data as JSON: /api/errors/eaba5267a7c8a7fc.
Report an issue: GitHub.
Appendix: source
Thrown at gitnexus/src/core/embeddings/embedding-local-init.ts:185
const endpointHint = process.env.HF_ENDPOINT
? `The configured endpoint (${process.env.HF_ENDPOINT}) may be unreachable.`
: `huggingface.co may be unreachable from your network.\n` +
` Set HF_ENDPOINT to a mirror and retry:\n` +
` HF_ENDPOINT=https://hf-mirror.com npx gitnexus analyze --embeddings\n` +
` (Windows: set HF_ENDPOINT=https://hf-mirror.com && npx gitnexus analyze --embeddings)`;
throw new Error(`Failed to download embedding model: ${errMsg}\n ${endpointHint}`);
}
if (isDev && (device === 'cuda' || device === 'dml')) {
const gpuType = device === 'dml' ? 'DirectML' : 'CUDA';
logger.info(`⚠️ ${gpuType} not available, falling back to CPU...`);
}
if (device === devicesToTry[devicesToTry.length - 1]) {
throw deviceError;
}
}
}
throw new Error('No suitable device found for embedding model');
} catch (error) {
initPromise = null;
embedderInstance = null;
throw error;
}
})();
return initPromise;
};
const getLocalEmbedder = (): FeatureExtractionPipeline => {
if (!embedderInstance) {
throw new Error('Embedder not initialized. Call initLocalEmbedder() first.');
}
return embedderInstance;
};
export const localEmbedBatch = async (texts: string[]): Promise<Float32Array[]> => {View on GitHub (pinned to ac9a4e9abd)