Mintplex-Labs/anything-llm · warning
[open-computer] WARNING: OPENAI_API_KEY not set — prompts wi
Error message
[open-computer] WARNING: OPENAI_API_KEY not set — prompts will fail (or set OPENAI_BASE_URL for local providers)
What it means
Boot-time warning from the open-computer service: neither OPENAI_API_KEY nor OPENAI_BASE_URL is set in the loaded settings, so every LLM prompt issued by the agent will fail at request time even though the HTTP server itself starts fine. OPENAI_BASE_URL is the escape hatch for local providers (Ollama, LM Studio, etc.) where no API key exists.
Source
Thrown at open-computer/services/interface-service/index.js:112
registerEventsWebSocket(server, streamWss);
registerUploadWebSocket(uploadWss);
// ─── Background tasks ──────────────────────────────────────────────────────
startDeliverablesPoller();
startIdleDetector();
// ─── Start ─────────────────────────────────────────────────────────────────
server.listen(PORT, "0.0.0.0", () => {
console.log(`[open-computer] Listening on :${PORT}`);
console.log(`[open-computer] Agent: ${settings.OPENAI_MODEL ? `${process.env.AGENT_NAME || "agent"} (model: ${settings.OPENAI_MODEL})` : process.env.AGENT_NAME || "agent"}`);
console.log(`[open-computer] noVNC proxy: /desktop → localhost:6080`);
console.log(`[open-computer] Extensions: ${path.join(SERVICE_ROOT, "extensions")}`);
if (!settings.OPENAI_API_KEY && !settings.OPENAI_BASE_URL) {
console.warn(
`[open-computer] WARNING: OPENAI_API_KEY not set — prompts will fail ` +
`(or set OPENAI_BASE_URL for local providers)`,
);
}
if (settings.OPENAI_BASE_URL) {
console.log(
`[open-computer] Base URL: ${settings.OPENAI_BASE_URL} ` +
`(guest: ${resolveBaseUrlForGuest(settings.OPENAI_BASE_URL)})`,
);
}
// Notify reconnecting clients on hot-reload
setTimeout(() => {
broadcast({ type: "agent_log", content: `[server] Reloaded at ${new Date().toLocaleTimeString()}` });
broadcast({ type: "agent_log", content: `[config] SUBAGENTS_MODE=${SUBAGENTS_MODE}` });
broadcast({ type: "agent_log", content: `[config] PARALLEL_SUBAGENTS=${PARALLEL_SUBAGENTS}` });
}, 500);
});View on GitHub (pinned to 3aec848f28)
Solutions
- Set OPENAI_API_KEY to a valid key for your provider and restart the service.
- For local providers, set OPENAI_BASE_URL (e.g. http://host.docker.internal:11434/v1) instead of a key.
- Verify the settings module actually loads the env file you edited (check SERVICE_ROOT/.env path).
- Confirm with a quick prompt once booted; the warning disappears when either variable is present.
Example fix
# before # OPENAI_API_KEY= (unset) # after OPENAI_API_KEY=sk-... # or for a local provider: OPENAI_BASE_URL=http://localhost:11434/v1
Defensive patterns
Strategy: validation
Validate before calling
// Startup assertion in a wrapper script before launching the service:
if (!process.env.OPENAI_API_KEY && !process.env.OPENAI_BASE_URL) {
console.error('Refusing to start: set OPENAI_API_KEY or OPENAI_BASE_URL');
process.exit(1);
} Prevention
- Use a .env template listing required keys and fail CI when they are absent.
- For local providers, always set OPENAI_BASE_URL so no key is expected.
- Verify the service loads the env file you actually edited.
- Smoke-test one prompt immediately after boot to catch config gaps early.
When it happens
Trigger: Running open-computer without sourcing its .env; key defined under a different name (e.g. OPENAI_KEY) or in a file the service does not load; env passed in compose but misspelled; local provider intended but base URL also unset.
Common situations: Fresh clone/deploy where env templating was skipped; container restarted without the original env file; switching from cloud to local model provider and forgetting OPENAI_BASE_URL.
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
- QEMU directory not found: ${dir}\nContents of ${parent}: ${c
- No Groq API key was set.
- KoboldCPP must have a valid base path to use for the api.
- KoboldCPP must have a valid model set.
- No token context limit was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/afc461e40838ac97.
Report an issue: GitHub.