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

  1. Set OPENAI_API_KEY to a valid key for your provider and restart the service.
  2. For local providers, set OPENAI_BASE_URL (e.g. http://host.docker.internal:11434/v1) instead of a key.
  3. Verify the settings module actually loads the env file you edited (check SERVICE_ROOT/.env path).
  4. 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

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


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