{"record":{"id":"1267c1eb313fdced","repo":"janhq/jan","slug":"llamacpp-extension-not-available-1267c1","errorCode":null,"errorMessage":"llamacpp extension not available","messagePattern":"llamacpp extension not available","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/vector-db-extension/src/index.ts","lineNumber":249,"sourceCode":"    if (count <= budget || text.length <= MIN_CHUNK_SIZE_CHARS) return [text]\n    const mid = Math.floor(text.length / 2)\n    return [\n      ...(await this.splitChunkToFit(text.slice(0, mid), budget, llm)),\n      ...(await this.splitChunkToFit(text.slice(mid), budget, llm)),\n    ]\n  }\n\n  private getEmbeddingEngine() {\n    return window.core?.extensionManager.getByName('@janhq/llamacpp-extension') as AIEngine & {\n      embed?: (texts: string[]) => Promise<{ data: Array<{ embedding: number[]; index: number }> }>\n      getEmbeddingContextSize?: () => Promise<number | undefined>\n      countEmbeddingTokens?: (texts: string[]) => Promise<number[]>\n    }\n  }\n\n  private async embedTexts(texts: string[]): Promise<number[][]> {\n    const llm = this.getEmbeddingEngine()\n    if (!llm?.embed) throw new Error('llamacpp extension not available')\n\n    const res = await llm.embed(texts)\n    const data: Array<{ embedding: number[]; index: number }> = res?.data || []\n    const out: number[][] = new Array(texts.length)\n    for (const item of data) {\n      out[item.index] = item.embedding\n    }\n    return out\n  }\n\n  async ingestFile(threadId: string, file: VectorDBFileInput, opts: VectorDBIngestOptions): Promise<AttachmentFileInfo> {\n    // Check for duplicate file (same name + path)\n    const existingFiles = await vecdb.listAttachments(this.collectionForThread(threadId)).catch(() => [])\n    const duplicate = existingFiles.find((f: any) => f.name === file.name && f.path === file.path)\n    if (duplicate) {\n      throw new Error(`File '${file.name}' has already been attached to this thread`)\n    }\n","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/extensions/vector-db-extension/src/index.ts#L231-L267","documentation":"Thrown by VectorDBExtension.embedTexts() when the llamacpp extension (resolved via getEmbeddingEngine / getByName) is missing or lacks an embed() method. This is the vector-db-extension's own embedding guard, mirroring rag-extension's error 66. All vector ingestion and search depends on it.","triggerScenarios":"Any ingestFile/ingestFileForProject/retrieval call when @janhq/llamacpp-extension is not loaded, crashed, or does not expose embed(); extension failed its native bind at startup.","commonSituations":"llamacpp-extension disabled while vector-db-extension is enabled; no embedding model configured; extension name refactored; native backend library missing prevented registration.","solutions":["Enable and register @janhq/llamacpp-extension (verify getByName returns it).","Load an embedding model so embed() is exposed.","Update llamacpp-extension to a version implementing embed().","Check the extension's startup log for a native dependency load failure."],"exampleFix":"// before\nawait vecdbExt.ingestFile(threadId, file, opts)\n\n// after\nconst llm = (window.core?.extensionManager.getByName('@janhq/llamacpp-extension') as any)\nif (!llm?.embed) {\n  throw new Error('Enable llamacpp-extension and load an embedding model')\n}\nawait vecdbExt.ingestFile(threadId, file, opts)","handlingStrategy":"type-guard","validationCode":"const llm = (window.core?.extensionManager.getByName('@janhq/llamacpp-extension') as any)\nif (!llm?.embed) {\n  // disable vector ingestion/search, prompt to enable extension + load embedding model\n}","typeGuard":"function hasEmbed(llm: unknown): llm is { embed: (t: string[]) => Promise<any> } {\n  return !!llm && typeof (llm as any).embed === 'function'\n}","tryCatchPattern":null,"preventionTips":["Keep llamacpp-extension enabled and registered alongside vector-db-extension.","Load an embedding model so embed() is present.","Verify extension startup logs for native-bind load failures."],"tags":["vector-db","embeddings","llamacpp","extension"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}