{"record":{"id":"c8bd50ff2ed9693e","repo":"Mintplex-Labs/anything-llm","slug":"no-ollama-base-path-was-set","errorCode":null,"errorMessage":"No Ollama Base Path was set.","messagePattern":"No Ollama Base Path was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/AiProviders/ollama/index.js","lineNumber":20,"sourceCode":"  writeResponseChunk,\n  clientAbortedHandler,\n  formatChatHistory,\n} = require(\"../../helpers/chat/responses\");\nconst { NativeEmbedder } = require(\"../../EmbeddingEngines/native\");\nconst {\n  LLMPerformanceMonitor,\n} = require(\"../../helpers/chat/LLMPerformanceMonitor\");\nconst { Ollama } = require(\"ollama\");\nconst { v4: uuidv4 } = require(\"uuid\");\n\n// Docs: https://github.com/jmorganca/ollama/blob/main/docs/api.md\nclass OllamaAILLM {\n  /** @see OllamaAILLM.cacheContextWindows */\n  static modelContextWindows = {};\n\n  constructor(embedder = null, modelPreference = null) {\n    if (!process.env.OLLAMA_BASE_PATH)\n      throw new Error(\"No Ollama Base Path was set.\");\n\n    this.className = \"OllamaAILLM\";\n    this.authToken = process.env.OLLAMA_AUTH_TOKEN;\n    this.basePath = process.env.OLLAMA_BASE_PATH;\n    this.model = modelPreference || process.env.OLLAMA_MODEL_PREF;\n    this.keepAlive = process.env.OLLAMA_KEEP_ALIVE_TIMEOUT\n      ? Number(process.env.OLLAMA_KEEP_ALIVE_TIMEOUT)\n      : 300; // Default 5-minute timeout for Ollama model loading.\n\n    const headers = this.authToken\n      ? { Authorization: `Bearer ${this.authToken}` }\n      : {};\n    this.client = new Ollama({\n      host: this.basePath,\n      headers: headers,\n      fetch: OllamaAILLM.applyOllamaFetch(),\n    });\n    this.embedder = embedder ?? new NativeEmbedder();","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/AiProviders/ollama/index.js#L2-L38","documentation":"Constructor guard in OllamaAILLM: the OLLAMA_BASE_PATH environment variable is unset, so there is no URL to point the Ollama client at and provider instantiation fails before any model lookup or chat.","triggerScenarios":"Thrown at provider construction when no Ollama base path is configured.","commonSituations":"Ollama selected without a base path.","solutions":["Set the Ollama base path (e.g. http://127.0.0.1:11434) in provider settings."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}