Mintplex-Labs/anything-llm · critical · Error
No Ollama image generation model was set.
Error message
No Ollama image generation model was set.
What it means
Thrown synchronously in the OllamaImageGenerator constructor after the base-path check. IMAGE_GEN_MODEL_PREF names the model Ollama will use for image generation via its /v1 endpoint; Ollama has no default here. This variable is shared across image providers.
Source
Thrown at server/utils/ImageGenerators/ollama/index.js:8
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(
`Ollama does not support image editing. Dropping ${images.length} reference image(s) and generating from prompt only.`
);View on GitHub (pinned to 526360e320)
Solutions
- Set IMAGE_GEN_MODEL_PREF to an image-capable model id available in your Ollama instance (e.g. after `ollama pull <model>`).
- Confirm the model is actually pulled/loaded by Ollama.
- Restart the server after setting the variable.
- Remember IMAGE_GEN_MODEL_PREF is shared across image providers.
Example fix
# before IMAGE_GEN_PROVIDER=ollama IMAGE_GEN_OLLAMA_BASE_PATH=http://localhost:11434 # (no model) # after IMAGE_GEN_PROVIDER=ollama IMAGE_GEN_OLLAMA_BASE_PATH=http://localhost:11434 IMAGE_GEN_MODEL_PREF=llava
Defensive patterns
Strategy: validation
Validate before calling
function hasImageModel() {
return typeof process.env.IMAGE_GEN_MODEL_PREF === 'string'
&& process.env.IMAGE_GEN_MODEL_PREF.trim().length > 0;
}
if (!hasImageModel()) {
throw new Error('Set IMAGE_GEN_MODEL_PREF before using image generation.');
} Type guard
function isImageModelSet() {
return !!process.env.IMAGE_GEN_MODEL_PREF && process.env.IMAGE_GEN_MODEL_PREF.trim().length > 0;
} Try / catch
try {
generator = new OllamaImageGenerator();
} catch (e) {
if (/No Ollama image generation model/.test(e.message)) {
throw new Error('Set IMAGE_GEN_MODEL_PREF to a model available in your Ollama instance and restart.');
}
throw e;
} Prevention
- Set IMAGE_GEN_MODEL_PREF to a model you have already `ollama pull`ed.
- IMAGE_GEN_MODEL_PREF is shared across image providers — set it per active provider.
- Validate required env vars together at startup.
- Restart after .env changes.
When it happens
Trigger: Instantiating new OllamaImageGenerator() when process.env.IMAGE_GEN_MODEL_PREF is unset or empty.
Common situations: Selecting Ollama image generation without specifying which pulled model to use; model not yet pulled into the Ollama instance; switching image providers and leaving the model field blank; env var missing in the container.
Related errors
- No Ollama image generation base path was set.
- No Lemonade image generation base path was set.
- No Lemonade image generation model was set.
- No OpenRouter image generation model was set.
- No OpenAI image generation API key was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/bb119c8a2288befb.
Report an issue: GitHub.