{"record":{"id":"8e99aa574d6f486b","repo":"Mintplex-Labs/anything-llm","slug":"no-lemonade-api-base-path-was-set","errorCode":null,"errorMessage":"No Lemonade API Base Path was set.","messagePattern":"No Lemonade API Base Path was set\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/AiProviders/lemonade/index.js","lineNumber":15,"sourceCode":"const { NativeEmbedder } = require(\"../../EmbeddingEngines/native\");\nconst {\n  handleDefaultStreamResponseV2,\n  formatChatHistory,\n} = require(\"../../helpers/chat/responses\");\nconst {\n  LLMPerformanceMonitor,\n} = require(\"../../helpers/chat/LLMPerformanceMonitor\");\nconst { OpenAI: OpenAIApi } = require(\"openai\");\nconst { humanFileSize } = require(\"../../helpers\");\n\nclass LemonadeLLM {\n  constructor(embedder = null, modelPreference = null) {\n    if (!process.env.LEMONADE_LLM_BASE_PATH)\n      throw new Error(\"No Lemonade API Base Path was set.\");\n    if (!process.env.LEMONADE_LLM_MODEL_PREF && !modelPreference)\n      throw new Error(\"No Lemonade Model Pref was set.\");\n\n    this.className = \"LemonadeLLM\";\n    this.lemonade = new OpenAIApi({\n      baseURL: parseLemonadeServerEndpoint(\n        process.env.LEMONADE_LLM_BASE_PATH,\n        \"openai\"\n      ),\n      apiKey: process.env.LEMONADE_LLM_API_KEY || null,\n    });\n\n    this.model = modelPreference || process.env.LEMONADE_LLM_MODEL_PREF;\n    this.embedder = embedder ?? new NativeEmbedder();\n    this.defaultTemp = 0.7;\n\n    // We can establish here since we cannot dynamically curl the context window limit from the API.\n    this.limits = {","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/AiProviders/lemonade/index.js#L1-L33","documentation":"Thrown by the LemonadeLLM constructor when the LEMONADE_LLM_BASE_PATH environment variable is not set. Unlike some providers, the base path has no constructor-parameter fallback — it must come from the environment. The Lemonade server URL is then parsed through parseLemonadeServerEndpoint to construct the OpenAI-compatible /api/v1 endpoint.","triggerScenarios":"Instantiating `new LemonadeLLM(embedder, model)` (via getLLMProvider('lemonade')) when process.env.LEMONADE_LLM_BASE_PATH is undefined or empty. The check is `if (!process.env.LEMONADE_LLM_BASE_PATH)`, so an empty string also triggers it.","commonSituations":"The 'lemonade' provider was selected in system or workspace LLM settings but the .env file was never configured with LEMONADE_LLM_BASE_PATH. A fresh deployment that copied .env.example (where the variable is commented out) without uncommenting and filling it.","solutions":["Set LEMONADE_LLM_BASE_PATH in .env to your Lemonade server's root URL (e.g. 'http://127.0.0.1:8000') and restart.","Verify the Lemonade server is running at that address by hitting its /live or /api/v1/models endpoint.","Ensure the .env file is in the correct location (server root or project root depending on deployment) and is loaded by the process."],"exampleFix":"// before: .env\n# LEMONADE_LLM_BASE_PATH='http://127.0.0.1:8000'\n\n// after\nLEMONADE_LLM_BASE_PATH='http://127.0.0.1:8000'","handlingStrategy":"validation","validationCode":"function validateLemonadeConfig() {\n  if (!process.env.LEMONADE_LLM_BASE_PATH) {\n    throw new Error(\n      'LEMONADE_LLM_BASE_PATH is not set. Configure it in .env (e.g. http://127.0.0.1:8000).'\n    );\n  }\n  return process.env.LEMONADE_LLM_BASE_PATH;\n}\n\n// Call at startup or before provider instantiation:\nvalidateLemonadeConfig();","typeGuard":null,"tryCatchPattern":"try {\n  const llm = new LemonadeLLM(embedder, model);\n} catch (e) {\n  if (e.message.includes('Base Path')) {\n    console.error('Configure LEMONADE_LLM_BASE_PATH in .env before using the Lemonade provider.');\n    return null;\n  }\n  throw e;\n}","preventionTips":["Run a startup config validator that checks all provider-specific env vars for the selected LLM provider.","Add the Lemonade base path to .env.example with a clear example URL.","Use a configuration UI that validates required fields before allowing the provider to be selected."],"tags":["lemonade","configuration","env-var","constructor","base-path"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}