Mintplex-Labs/anything-llm · error · Error
TextWebGenUI API base path must be provided to use agents.
Error message
TextWebGenUI API base path must be provided to use agents.
What it means
Thrown by AgentHandler.checkSetup() (server/utils/agents/index.js:189) when the workspace agent provider is 'textgenwebui' but TEXT_GEN_WEB_UI_BASE_PATH is unset/empty. text-generation-webui exposes an OpenAI-compatible extension server; AnythingLLM only needs its base URL, which this guard validates. (The message string 'TextWebGenUI' is a cosmetic typo for text-generation-webui but the check itself is correct.)
Source
Thrown at server/utils/agents/index.js:190
case "openrouter":
if (!process.env.OPENROUTER_API_KEY)
throw new Error("OpenRouter API key must be provided to use agents.");
break;
case "mistral":
if (!process.env.MISTRAL_API_KEY)
throw new Error("Mistral API key must be provided to use agents.");
break;
case "generic-openai":
if (!process.env.GENERIC_OPEN_AI_BASE_PATH)
throw new Error("API base path must be provided to use agents.");
break;
case "perplexity":
if (!process.env.PERPLEXITY_API_KEY)
throw new Error("Perplexity API key must be provided to use agents.");
break;
case "textgenwebui":
if (!process.env.TEXT_GEN_WEB_UI_BASE_PATH)
throw new Error(
"TextWebGenUI API base path must be provided to use agents."
);
break;
case "bedrock":
// No validations since there are many possible authentication methods
break;
case "fireworksai":
if (!process.env.FIREWORKS_AI_LLM_API_KEY)
throw new Error(
"FireworksAI API Key must be provided to use agents."
);
break;
case "deepseek":
if (!process.env.DEEPSEEK_API_KEY)
throw new Error("DeepSeek API Key must be provided to use agents.");
break;
case "litellm":
if (!process.env.LITE_LLM_BASE_PATH)View on GitHub (pinned to 526360e320)
Solutions
- Start the text-generation-webui OpenAI extension (or worker) and set TEXT_GEN_WEB_UI_BASE_PATH in .env to its URL (e.g. http://127.0.0.1:5000/v1).
- Restart AnythingLLM so process.env reloads.
- curl <base path>/models from the AnythingLLM host to confirm the extension is serving.
- If AnythingLLM is containerized, point at the host IP or docker network address rather than 127.0.0.1.
Example fix
// before (.env) // TEXT_GEN_WEB_UI_BASE_PATH= // after (.env) TEXT_GEN_WEB_UI_BASE_PATH=http://127.0.0.1:5000/v1
Defensive patterns
Strategy: validation
Validate before calling
const base = process.env.TEXT_GEN_WEB_UI_BASE_PATH;
if (!base) {
throw new Error(
'Cannot start text-generation-webui agent: set TEXT_GEN_WEB_UI_BASE_PATH (e.g. http://127.0.0.1:5000/v1) in .env.'
);
}
try { new URL(base); } catch { throw new Error('TEXT_GEN_WEB_UI_BASE_PATH is not a valid URL'); } Try / catch
try {
await agentHandler.start();
} catch (e) {
if (/TextWebGenUI API base path/.test(e.message)) {
return respondConfigError('textgenwebui', ['TEXT_GEN_WEB_UI_BASE_PATH']);
}
throw e;
} Prevention
- Start the text-generation-webui OpenAI extension before selecting the provider.
- Use a host/docker-network address, not 127.0.0.1, when AnythingLLM is containerized.
- Restart AnythingLLM after .env changes.
- Add a boot reachability check for the configured base path.
When it happens
Trigger: An agent invocation runs with workspace.agentProvider === 'textgenwebui' while TEXT_GEN_WEB_UI_BASE_PATH is absent from process.env. Path: #providerSetupAndCheck() -> checkSetup() at index.js:476.
Common situations: text-generation-webui provider chosen in System > LLM Preference without entering the server URL; the OpenAI/worker extension not started in the webui so the URL is unreachable even after being set; .env present but Node not restarted; the extension listens on 127.0.0.1:5000 while AnythingLLM runs in a container where that resolves to itself.
Related errors
- KoboldCPP must have a valid base path to use for the api.
- LocalAI must have a valid base path to use for the api.
- Azure OpenAI API endpoint and key must be provided to use ag
- OpenRouter API key must be provided to use agents.
- Mistral API key must be provided to use agents.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/2b6a61a0f412c9ff.
Report an issue: GitHub.