Repository navigation
fix(server): say which key to set when an agent has no LLM credentials - #243
Merged
Merged
Conversation
2 of 4 tasks
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
force-pushed
the
fix/missing-llm-key-notice
branch
from
December 3, 2026 17:24
303cd7b to
9f5cfa9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.describeRunFailurenow recognizes that error and gives the reason as what to do instead:It names
OPENAI_API_KEY,ANTHROPIC_API_KEYorGEMINI_API_KEYby provider, and otherwise says "Set an API key for ". Every other failure reason is unchanged.Screenshots
N/A
How to test
cd apps/server && pnpm exec tsx --test src/conversation/causes.test.ts: 13 tests pass, including the new missing-key case.OPENAI_API_KEY,ANTHROPIC_API_KEY,PI_PROXY_URLorPI_PROXY_API_KEY, open a session and send a message. The run-error notice ends with the sentence above.pnpm typecheck,pnpm lintandcd apps/server && pnpm testpass (855 tests).Notes
mainafter fix(server): say why a run failed in the run-error notice #231 merged; GitHub had auto-closed this PR when fix(server): say why a run failed in the run-error notice #231's branch was deleted.🤖 Generated with Claude Code