janhq/jan · error · Error
llamacpp extension not available
Error message
llamacpp extension not available
What it means
Thrown by RAGExtension.embedTexts() when the llamacpp extension cannot be resolved by name (@janhq/llamacpp-extension) OR is present but does not expose an embed() method. Embeddings are delegated entirely to llamacpp, so RAG retrieval is impossible without it. The guard fires before any network/embed call.
Source
Thrown at extensions/rag-extension/src/index.ts:545
async parseDocument(path: string, type?: string): Promise<string> {
return await ragApi.parseDocument(path, type || 'application/octet-stream')
}
async embed(texts: string[]): Promise<number[][]> {
if (!texts || texts.length === 0) return []
return this.embedTexts(texts)
}
// Locally implement embedding logic (previously in embeddings-extension)
private async embedTexts(texts: string[]): Promise<number[][]> {
const llm = window.core?.extensionManager.getByName(
'@janhq/llamacpp-extension'
) as AIEngine & {
embed?: (
texts: string[]
) => Promise<{ data: Array<{ embedding: number[]; index: number }> }>
}
if (!llm?.embed) throw new Error('llamacpp extension not available')
const res = await llm.embed(texts)
const data: Array<{ embedding: number[]; index: number }> = res?.data || []
const out: number[][] = new Array(texts.length)
for (const item of data) {
out[item.index] = item.embedding
}
return out
}
}
View on GitHub (pinned to fad3f12a14)
Solutions
- Enable @janhq/llamacpp-extension and confirm it is registered (getByName returns it).
- Load/configure an embedding model so embed() is exposed by the extension.
- Update llamacpp-extension to a version that implements embed().
- Guard retrieval calls and disable RAG features gracefully when embeddings are unavailable.
Example fix
// before
const vec = await rag.embed(texts)
// after
const llm = window.core?.extensionManager.getByName('@janhq/llamacpp-extension') as any
if (!llm?.embed) {
throw new Error('Enable llamacpp-extension and load an embedding model to use RAG')
}
const vec = await rag.embed(texts) Defensive patterns
Strategy: type-guard
Validate before calling
const llm = window.core?.extensionManager.getByName('@janhq/llamacpp-extension') as any
if (!llm?.embed) {
// disable RAG retrieval, or prompt to enable the extension / load an embedding model
} Type guard
function hasEmbed(llm: unknown): llm is { embed: (t: string[]) => Promise<any> } {
return !!llm && typeof (llm as any).embed === 'function'
} Prevention
- Load an embedding model before enabling RAG.
- Confirm llamacpp-extension is enabled and registered.
- Disable RAG features gracefully when embeddings are unavailable.
When it happens
Trigger: Calling rag.embed(texts) or any RAG retrieval path with no llamacpp-extension loaded; llamacpp-extension loaded but its embed() was stripped or not yet initialized; extension name changed in a refactor.
Common situations: llamacpp-extension disabled or failed to start; running on a build that ships inference without embedding support; no embedding model configured so the extension omits embed().
Related errors
- llamacpp extension not available
- Vector DB extension does not support project-level ingestion
- Vector DB extension not available
- Failed to determine embedding context size: ${e instanceof E
- Failed to count embedding tokens: ${e instanceof Error ? e.m
AI-assisted analysis of janhq/jan@fad3f12a14 (2026-08-12).
Data as JSON: /api/errors/7dab41d3786335b3.
Report an issue: GitHub.