Mintplex-Labs/anything-llm · critical · Error

Ollama base path must be provided to use agents.

Error message

Ollama base path must be provided to use agents.

What it means

checkSetup() (index.js:142-145) throws for provider === "ollama" when process.env.OLLAMA_BASE_PATH is falsy. Ollama runs locally, so the agent layer requires its base URL before proceeding.

Source

Thrown at server/utils/agents/index.js:144

  }

  checkSetup() {
    switch (this.provider) {
      case "openai":
        if (!process.env.OPEN_AI_KEY)
          throw new Error("OpenAI API key must be provided to use agents.");
        break;
      case "anthropic":
        if (!process.env.ANTHROPIC_API_KEY)
          throw new Error("Anthropic API key must be provided to use agents.");
        break;
      case "lmstudio":
        if (!process.env.LMSTUDIO_BASE_PATH)
          throw new Error("LMStudio base path must be provided to use agents.");
        break;
      case "ollama":
        if (!process.env.OLLAMA_BASE_PATH)
          throw new Error("Ollama base path must be provided to use agents.");
        break;
      case "groq":
        if (!process.env.GROQ_API_KEY)
          throw new Error("Groq API key must be provided to use agents.");
        break;
      case "togetherai":
        if (!process.env.TOGETHER_AI_API_KEY)
          throw new Error("TogetherAI API key must be provided to use agents.");
        break;
      case "azure":
        if (!process.env.AZURE_OPENAI_ENDPOINT || !process.env.AZURE_OPENAI_KEY)
          throw new Error(
            "Azure OpenAI API endpoint and key must be provided to use agents."
          );
        break;
      case "koboldcpp":
        if (!process.env.KOBOLD_CPP_BASE_PATH)
          throw new Error(

View on GitHub (pinned to 526360e320)

Solutions

  1. Set OLLAMA_BASE_PATH in .env (e.g. http://127.0.0.1:11434, or http://host.docker.internal:11434 inside Docker).
  2. Ensure Ollama is installed, running, and has pulled a model.
  3. Restart the server after saving .env.
  4. Confirm network reachability from the server process to Ollama.

Example fix

# before (.env)
# OLLAMA_BASE_PATH=

# after (.env)
OLLAMA_BASE_PATH=http://127.0.0.1:11434
Defensive patterns

Strategy: validation

Validate before calling

function ollamaAgentReady() {
  return Boolean(process.env.OLLAMA_BASE_PATH && process.env.OLLAMA_BASE_PATH.trim());
}
if (provider === "ollama" && !ollamaAgentReady())
  throw new Error("Set OLLAMA_BASE_PATH (e.g. http://127.0.0.1:11434) before enabling the ollama agent.");

Try / catch

try {
  agent.checkSetup();
} catch (e) {
  if (/OLLAMA_BASE_PATH|base path must be provided/i.test(e.message)) {
    throw new Error("Ollama agent is not configured: set OLLAMA_BASE_PATH in .env and restart.");
  }
  throw e;
}

Prevention

When it happens

Trigger: Selecting the ollama agent provider while OLLAMA_BASE_PATH is unset, typically because the local Ollama server URL was never configured.

Common situations: Local-only provider chosen without setting the URL, Ollama not yet running, or a Docker deployment where the host URL wasn't passed (e.g. forgot http://host.docker.internal:11434).

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/5b130c99378de24a. Report an issue: GitHub.