{"record":{"id":"2bb8dc63e8061186","repo":"chroma-core/chroma","slug":"failed-to-instantiate-ollama-client","errorCode":null,"errorMessage":"Failed to instantiate Ollama client","messagePattern":"Failed to instantiate Ollama client","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clients/new-js/packages/ai-embeddings/ollama/src/index.ts","lineNumber":49,"sourceCode":"    } = args;\n    this.url = url;\n    this.model = model;\n  }\n\n  private async import() {\n    if (isBrowser()) {\n      const { Ollama } = await import(\"ollama/browser\");\n      this.client = new Ollama({ host: this.url });\n    } else {\n      const { Ollama } = await import(\"ollama\");\n      this.client = new Ollama({ host: this.url });\n    }\n  }\n\n  public async generate(texts: string[]): Promise<number[][]> {\n    await this.import();\n    if (!this.client) {\n      throw new Error(\"Failed to instantiate Ollama client\");\n    }\n    const response = await this.client.embed({\n      model: this.model,\n      input: texts,\n    });\n    return response.embeddings;\n  }\n\n  public defaultSpace(): EmbeddingFunctionSpace {\n    return \"cosine\";\n  }\n\n  public supportedSpaces(): EmbeddingFunctionSpace[] {\n    return [\"cosine\", \"l2\", \"ip\"];\n  }\n\n  public static buildFromConfig(config: OllamaConfig): OllamaEmbeddingFunction {\n    return new OllamaEmbeddingFunction({","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/chroma-core/chroma/blob/aecdd12c8a891610db8653630b066b32ceb678b5/clients/new-js/packages/ai-embeddings/ollama/src/index.ts#L31-L67","documentation":"Error \"Failed to instantiate Ollama client\" thrown in chroma-core/chroma.","triggerScenarios":"Thrown at clients/new-js/packages/ai-embeddings/ollama/src/index.ts:49 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aecdd12c8a891610db8653630b066b32ceb678b5","analyzedAt":"2026-08-16T21:53:27.228Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}