Skip to content

fix(server): say which key to set when an agent has no LLM credentials - #243

Merged
camielvs merged 1 commit into
mainfrom
fix/missing-llm-key-notice
Dec 3, 2026
Merged

camielvs merged 1 commit into
mainfrom
fix/missing-llm-key-notice

Conversation

@camielvs

@camielvs camielvs commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

When the shell has no LLM credentials, every message to an agent fails, and the chat only says "This agent's run ended with an error, so its work stopped without finishing." The cause, Pi's No API key found for openai, only shows up in the server log. This came up in a from-scratch local install: nothing in the UI said a key was missing.

#231 (merged) added the failure reason to that notice. With #231 alone the reason is Pi's raw message: No API key found for openai. Use /login to log into a provider via OAuth or API key. See: /…/node_modules/…/docs/providers.md …. That's advice for Pi's interactive CLI, plus file paths on the server, neither of which helps someone using the shell.

describeRunFailure now recognizes that error and gives the reason as what to do instead:

No API key is set for openai. Set OPENAI_API_KEY where Tangent runs, or set both PI_PROXY_URL and PI_PROXY_API_KEY to use an LLM gateway, then restart Tangent.

It names OPENAI_API_KEY, ANTHROPIC_API_KEY or GEMINI_API_KEY by provider, and otherwise says "Set an API key for ". Every other failure reason is unchanged.

Screenshots

N/A

How to test

  1. cd apps/server && pnpm exec tsx --test src/conversation/causes.test.ts: 13 tests pass, including the new missing-key case.
  2. Start the shell with no OPENAI_API_KEY, ANTHROPIC_API_KEY, PI_PROXY_URL or PI_PROXY_API_KEY, open a session and send a message. The run-error notice ends with the sentence above.
  3. pnpm typecheck, pnpm lint and cd apps/server && pnpm test pass (855 tests).

Notes

🤖 Generated with Claude Code

@camielvs
camielvs requested a review from a team as a code owner December 2, 2026 22:39
@camielvs
camielvs deleted the branch fix/run-error-reason December 3, 2026 00:47
@camielvs camielvs closed this Dec 3, 2026
@camielvs camielvs reopened this Dec 3, 2026
@camielvs
camielvs changed the base branch from fix/run-error-reason to main December 3, 2026 17:23
With no provider key, Pi rejects every prompt with "No API key found for
openai" plus advice for its interactive CLI (/login, docs on disk). The
run-error reason now names the variable to set (OPENAI_API_KEY,
ANTHROPIC_API_KEY, GEMINI_API_KEY) or the LLM gateway pair instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@camielvs
camielvs force-pushed the fix/missing-llm-key-notice branch from 303cd7b to 9f5cfa9 Compare December 3, 2026 17:24
@camielvs
camielvs merged commit 8f7c299 into main Dec 3, 2026
10 checks passed
@camielvs
camielvs deleted the fix/missing-llm-key-notice branch December 3, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant