Mintplex-Labs/anything-llm · critical · Error

No Ollama image generation base path was set.

Error message

No Ollama image generation base path was set.

What it means

Thrown synchronously in the OllamaImageGenerator constructor before building the OpenAI client. IMAGE_GEN_OLLAMA_BASE_PATH is required because the code appends /v1 to it to form the OpenAI-compatible baseURL. Without it there is no endpoint. Note image generation on Ollama is experimental and macOS-only per the code comment.

Source

Thrown at server/utils/ImageGenerators/ollama/index.js:6

const { BaseImageGenerator } = require("../base");

class OllamaImageGenerator extends BaseImageGenerator {
  constructor() {
    if (!process.env.IMAGE_GEN_OLLAMA_BASE_PATH)
      throw new Error("No Ollama image generation base path was set.");
    if (!process.env.IMAGE_GEN_MODEL_PREF)
      throw new Error("No Ollama image generation model was set.");
    const { OpenAI: OpenAIApi } = require("openai");
    // Ollama serves image generation through its OpenAI-compatible `/v1`
    // endpoint (experimental, macOS only).
    const basePath = process.env.IMAGE_GEN_OLLAMA_BASE_PATH.replace(/\/+$/, "");
    super({
      client: new OpenAIApi({
        baseURL: `${basePath}/v1`,
        apiKey: process.env.IMAGE_GEN_OLLAMA_AUTH_TOKEN || "ollama",
      }),
      model: process.env.IMAGE_GEN_MODEL_PREF,
      className: "OllamaImageGenerator",
    });
  }

  async editImage({ prompt, images, signal }) {
    this.log(

View on GitHub (pinned to 526360e320)

Solutions

  1. Set IMAGE_GEN_OLLAMA_BASE_PATH to your Ollama server URL (e.g. http://localhost:11434) in .env.
  2. Ensure you are on a platform/build where Ollama supports image generation (experimental, macOS only per the code).
  3. Restart the server after setting the variable.
  4. Use the exact variable name IMAGE_GEN_OLLAMA_BASE_PATH.

Example fix

# before
IMAGE_GEN_PROVIDER=ollama
# (no base path)

# after
IMAGE_GEN_PROVIDER=ollama
IMAGE_GEN_OLLAMA_BASE_PATH=http://localhost:11434
Defensive patterns

Strategy: validation

Validate before calling

function hasOllamaBasePath() {
  return typeof process.env.IMAGE_GEN_OLLAMA_BASE_PATH === 'string'
    && process.env.IMAGE_GEN_OLLAMA_BASE_PATH.trim().length > 0;
}
if (!hasOllamaBasePath()) {
  throw new Error('Set IMAGE_GEN_OLLAMA_BASE_PATH before using Ollama image generation.');
}

Type guard

function isOllamaBasePathSet() {
  return !!process.env.IMAGE_GEN_OLLAMA_BASE_PATH && process.env.IMAGE_GEN_OLLAMA_BASE_PATH.trim().length > 0;
}

Try / catch

try {
  generator = new OllamaImageGenerator();
} catch (e) {
  if (/No Ollama image generation base path/.test(e.message)) {
    throw new Error('Configure IMAGE_GEN_OLLAMA_BASE_PATH (experimental, macOS-only) and restart.');
  }
  throw e;
}

Prevention

When it happens

Trigger: Instantiating new OllamaImageGenerator() when process.env.IMAGE_GEN_OLLAMA_BASE_PATH is unset or empty.

Common situations: Selecting Ollama as the image-generation engine without pointing at the Ollama server; env var not propagated into the container; using a typo'd name (e.g. OLLAMA_BASE_PATH); Ollama not running image generation (experimental, macOS only) but the provider selected anyway.

Related errors


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