Mintplex-Labs/anything-llm · error

No Lemonade image generation base path was set.

Error message

No Lemonade image generation base path was set.

What it means

The LemonadeImageGenerator constructor throws immediately when IMAGE_GEN_LEMONADE_BASE_PATH is unset or empty. The value is required to build the OpenAI SDK client: it is passed through parseLemonadeServerEndpoint(..., "openai") to derive the Lemonade server's OpenAI-compatible endpoint. Selection fails fast before any request is made.

Solutions

  1. Set IMAGE_GEN_LEMONADE_BASE_PATH in .env to the Lemonade server endpoint, e.g. http://localhost:8000.
  2. Confirm the Lemonade server is running and reachable from AnythingLLM.
  3. Restart the server / recreate the container after saving.
  4. Check the variable spelling and that the URL includes the scheme (http://).

Example fix

# .env — before
IMAGE_GEN_ENGINE=lemonade

# .env — after
IMAGE_GEN_ENGINE=lemonade
IMAGE_GEN_LEMONADE_BASE_PATH=http://localhost:8000
Defensive patterns

Strategy: validation

Validate before calling

if (!process.env.IMAGE_GEN_LEMONADE_BASE_PATH) {
  throw new Error(
    "Lemonade image engine selected but IMAGE_GEN_LEMONADE_BASE_PATH is missing."
  );
}
const { LemonadeImageGenerator } = require("server/utils/ImageGenerators/lemonade");
const generator = new LemonadeImageGenerator();

Type guard

function isLemonadeImageConfigValid(env = process.env) {
  return (
    typeof env.IMAGE_GEN_LEMONADE_BASE_PATH === "string" &&
    env.IMAGE_GEN_LEMONADE_BASE_PATH.length > 0
  );
}

Try / catch

try {
  new LemonadeImageGenerator();
} catch (err) {
  if (err.message.includes("Lemonade image generation base path")) {
    // surface a settings error for IMAGE_GEN_LEMONADE_BASE_PATH
  }
}

Prevention

When it happens

Trigger: Choosing Lemonade as the image engine without setting IMAGE_GEN_LEMONADE_BASE_PATH; adding the env after the process started without a restart; a typo in the variable name; docker env not propagated to the container.

Common situations: Setting up Lemonade (AMD/NPU local server) image generation for the first time; forgetting that the image-gen base path is a separate variable from the LLM provider's base path.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/3bae477508e039c5. Report an issue: GitHub.

Appendix: source

Thrown at server/utils/ImageGenerators/lemonade/index.js:7

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

class LemonadeImageGenerator extends BaseImageGenerator {
  constructor() {
    if (!process.env.IMAGE_GEN_LEMONADE_BASE_PATH)
      throw new Error("No Lemonade image generation base path was set.");
    if (!process.env.IMAGE_GEN_MODEL_PREF)
      throw new Error("No Lemonade image generation model was set.");
    const { OpenAI: OpenAIApi } = require("openai");
    super({
      client: new OpenAIApi({
        baseURL: parseLemonadeServerEndpoint(
          process.env.IMAGE_GEN_LEMONADE_BASE_PATH,
          "openai"
        ),
        apiKey: process.env.IMAGE_GEN_LEMONADE_API_KEY || null,
      }),
      model: process.env.IMAGE_GEN_MODEL_PREF,
      className: "LemonadeImageGenerator",
    });
  }
}

module.exports = { LemonadeImageGenerator };

View on GitHub (pinned to 3aec848f28)