janhq/jan · error

llamacpp extension not available

Error message

llamacpp extension not available

What it means

embedTexts() in core/src/browser/extensions/engines/embedding.ts throws this when no embedding engine is registered under the EMBEDDING_ENGINE_EXTENSION lookup key, or the found engine lacks an embed() capability (canEmbed returns false). The core embedder depends on the llamacpp extension being installed and ready; without it there is no way to compute embeddings, so the call fails fast instead of returning garbage vectors.

Solutions

  1. Ensure the llamacpp extension is installed and enabled so it registers the EMBEDDING_ENGINE_EXTENSION provider
  2. Wait for provisioning/bootstrap (e.g. ensureProvisioned) to complete before calling embedTexts
  3. Reinstall or repair the llamacpp extension if it failed to load
  4. Check that the extension's embed() capability is properly advertised to core

Example fix

// before
const vectors = await embedTexts(chunks)
// after
await ensureProvisioned()
const vectors = await embedTexts(chunks)
Defensive patterns

Strategy: try-catch

Validate before calling

// before calling
const engine = lookup(EMBEDDING_ENGINE_EXTENSION)
if (!engine || !canEmbed(engine)) throw new SkipEmbeddingError()
await embedTexts(texts)

Type guard

const isEmbedEngine = (e: unknown): e is { embed(texts: string[]): Promise<{ data: { index: number; embedding: number[] }[] }> } =>
  !!e && typeof (e as any).embed === 'function'

Try / catch

try {
  const vectors = await embedTexts(texts)
} catch (e) {
  if (e.message === 'llamacpp extension not available') {
    await ensureProvisioned(); retryOrDegrade(e)
  } else throw e
}

Prevention

When it happens

Trigger: Calling embedTexts(), or any dependent path (queryEmb, embed, embeddings), before the llamacpp extension is registered/activated; the extension was uninstalled or failed to load; the registered engine does not implement embed().

Common situations: Fresh Jan install where the llamacpp extension has not finished bootstrapping; embedding queries run at app startup before provisioning completes; the extension was disabled or removed; running in a browser/core-only test environment where extensions never register.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of janhq/jan@7205d770c1 (2026-09-17). Data as JSON: /api/errors/e510138bcd599757. Report an issue: GitHub.

Appendix: source

Thrown at core/src/browser/extensions/engines/embedding.ts:39

 */
export function getEmbeddingEngine(
  extensionName: string = EMBEDDING_ENGINE_EXTENSION
): (AIEngine & EmbeddingEngine) | undefined {
  const engine = lookup(extensionName)
  return isEmbeddingEngine(engine) ? engine : undefined
}

/**
 * Embeds `texts` and returns the vectors positionally.
 *
 * The response is keyed by `index` rather than ordered, so the result is
 * scattered back into place; a caller that trusted response order would
 * silently mismatch vectors to chunks.
 */
export async function embedTexts(texts: string[]): Promise<number[][]> {
  if (!texts.length) return []
  const engine = lookup(EMBEDDING_ENGINE_EXTENSION)
  if (!canEmbed(engine)) throw new Error('llamacpp extension not available')

  const res = await engine.embed(texts)
  const out: number[][] = new Array(texts.length)
  for (const item of res?.data ?? []) {
    out[item.index] = item.embedding
  }
  return out
}

View on GitHub (pinned to 7205d770c1)