Skip to content

agent_ui: Replace raw error messages with user-friendly copy in the agent panel#53099

Merged
rtfeldman merged 4 commits intomainfrom
agent-errors-copy
Apr 10, 2026
Merged

agent_ui: Replace raw error messages with user-friendly copy in the agent panel#53099
rtfeldman merged 4 commits intomainfrom
agent-errors-copy

Conversation

@katie-z-geer
Copy link
Copy Markdown
Contributor

@katie-z-geer katie-z-geer commented Apr 3, 2026

Replaces raw provider error strings in the agent panel with specific, user-friendly error callouts. Each error now has a clear title, actionable copy, and appropriate buttons instead of the generic "An Error Happened" fallback.

Error variants added:

Variant Title Body Trigger
RateLimitExceeded Rate Limit Reached {Provider}'s rate limit was reached. Zed will retry automatically. You can also wait a moment and try again. Provider rate limit exhausted after retries
ServerOverloaded Provider Unavailable {Provider}'s servers are temporarily unavailable. Zed will retry automatically. If the problem persists, check the provider's status page. Provider server overloaded or internal server error
PromptTooLarge Context Too Large This conversation is too long for the model's context window. Start a new thread or remove some attached files to continue. Conversation exceeds model's context window
NoApiKey API Key Missing No API key is configured for {Provider}. Add your key via the Agent Panel settings to continue. No API key configured for a direct provider
StreamError Connection Interrupted The connection to {Provider}'s API was interrupted. Zed will retry automatically. If the problem persists, check your network connection. Stream dropped or I/O error during generation
InvalidApiKey Invalid API Key The API key for {Provider} is invalid or has expired. Update your key via the Agent Panel settings to continue. API key present but invalid or expired
PermissionDenied Permission Denied {Provider}'s API rejected the request due to insufficient permissions. Check that your API key has access to this model. API key lacks access to the requested model
RequestFailed Request Failed The request could not be completed after multiple attempts. Try again in a moment. Upstream provider unreachable after retries
MaxOutputTokens Output Limit Reached The model stopped because it reached its maximum output length. You can ask it to continue where it left off. Model hit its maximum output token budget
NoModelSelected No Model Selected Select a model from the model picker below to get started. No model configured when a message is sent
ApiError API Error {Provider}'s API returned an unexpected error. If the problem persists, try switching models or restarting Zed.

Approach

  • Added typed errors (NoModelConfiguredError, MaxOutputTokensError) where previously raw strings were used, so they can be reliably downcast
  • Extended From<anyhow::Error> for ThreadError to downcast LanguageModelCompletionError variants before falling through to the generic Other case
  • Each variant has a dedicated render_* function with appropriate buttons (retry icon, New Thread, or none)
  • Telemetry events updated with specific kind labels for each new variant

Release Notes:

  • Improved error messages in the agent panel to show specific, actionable copy instead of raw provider error strings

Self-Review Checklist:

  • [ x] I've reviewed my own diff for quality, security, and reliability
  • [n/a] Unsafe blocks (if any) have justifying comments
  • [ x] The content is consistent with the UI/UX checklist
  • [n/a ] Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

Improved error messages in the agent panel to show specific, actionable copy instead of raw provider error strings

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Apr 3, 2026
@zed-community-bot zed-community-bot bot added the staff Pull requests authored by a current member of Zed staff label Apr 3, 2026
.dismiss_action(self.dismiss_error_button(cx))
}

fn render_rate_limit_error(&self, provider: SharedString, cx: &mut Context<Self>) -> Callout {
Copy link
Copy Markdown
Member

@mikayla-maki mikayla-maki Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these render functions are almost the same. Can you ask the agent to consolidate them into one or two general methods, that we can call from the match arms?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Agent working on that now.

@mikayla-maki mikayla-maki dismissed their stale review April 5, 2026 20:48

Actually, this feedback should have been given post-hoc

@rtfeldman rtfeldman merged commit 4e0022c into main Apr 10, 2026
30 checks passed
@rtfeldman rtfeldman deleted the agent-errors-copy branch April 10, 2026 21:17
rtfeldman pushed a commit that referenced this pull request Apr 10, 2026
…gent panel (#53099)

Replaces raw provider error strings in the agent panel with specific,
user-friendly error callouts. Each error now has a clear title,
actionable copy, and appropriate buttons instead of the generic "An
Error Happened" fallback.

Error variants added:

Variant | Title | Body | Trigger |
|---|---|---|---|
| `RateLimitExceeded` | Rate Limit Reached | {Provider}'s rate limit was
reached. Zed will retry automatically. You can also wait a moment and
try again. | Provider rate limit exhausted after retries |
| `ServerOverloaded` | Provider Unavailable | {Provider}'s servers are
temporarily unavailable. Zed will retry automatically. If the problem
persists, check the provider's status page. | Provider server overloaded
or internal server error |
| `PromptTooLarge` | Context Too Large | This conversation is too long
for the model's context window. Start a new thread or remove some
attached files to continue. | Conversation exceeds model's context
window |
| `NoApiKey` | API Key Missing | No API key is configured for
{Provider}. Add your key via the Agent Panel settings to continue. | No
API key configured for a direct provider |
| `StreamError` | Connection Interrupted | The connection to
{Provider}'s API was interrupted. Zed will retry automatically. If the
problem persists, check your network connection. | Stream dropped or I/O
error during generation |
| `InvalidApiKey` | Invalid API Key | The API key for {Provider} is
invalid or has expired. Update your key via the Agent Panel settings to
continue. | API key present but invalid or expired |
| `PermissionDenied` | Permission Denied | {Provider}'s API rejected the
request due to insufficient permissions. Check that your API key has
access to this model. | API key lacks access to the requested model |
| `RequestFailed` | Request Failed | The request could not be completed
after multiple attempts. Try again in a moment. | Upstream provider
unreachable after retries |
| `MaxOutputTokens` | Output Limit Reached | The model stopped because
it reached its maximum output length. You can ask it to continue where
it left off. | Model hit its maximum output token budget |
| `NoModelSelected` | No Model Selected | Select a model from the model
picker below to get started. | No model configured when a message is
sent |
| `ApiError` | API Error | {Provider}'s API returned an unexpected
error. If the problem persists, try switching models or restarting Zed.
## Approach

- Added typed errors (`NoModelConfiguredError`, `MaxOutputTokensError`)
where previously raw strings were used, so they can be reliably downcast
- Extended `From<anyhow::Error> for ThreadError` to downcast
`LanguageModelCompletionError` variants before falling through to the
generic `Other` case
- Each variant has a dedicated `render_*` function with appropriate
buttons (retry icon, New Thread, or none)
- Telemetry events updated with specific `kind` labels for each new
variant

Release Notes:

- Improved error messages in the agent panel to show specific,
actionable copy instead of raw provider error strings

Self-Review Checklist:

- [ x] I've reviewed my own diff for quality, security, and reliability
- [n/a] Unsafe blocks (if any) have justifying comments
- [ x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [n/a ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable


Release Notes:

Improved error messages in the agent panel to show specific, actionable
copy instead of raw provider error strings
maxbrunsfeld pushed a commit that referenced this pull request Apr 10, 2026
…gent panel (#53099)

Replaces raw provider error strings in the agent panel with specific,
user-friendly error callouts. Each error now has a clear title,
actionable copy, and appropriate buttons instead of the generic "An
Error Happened" fallback.

Error variants added:

Variant | Title | Body | Trigger |
|---|---|---|---|
| `RateLimitExceeded` | Rate Limit Reached | {Provider}'s rate limit was
reached. Zed will retry automatically. You can also wait a moment and
try again. | Provider rate limit exhausted after retries |
| `ServerOverloaded` | Provider Unavailable | {Provider}'s servers are
temporarily unavailable. Zed will retry automatically. If the problem
persists, check the provider's status page. | Provider server overloaded
or internal server error |
| `PromptTooLarge` | Context Too Large | This conversation is too long
for the model's context window. Start a new thread or remove some
attached files to continue. | Conversation exceeds model's context
window |
| `NoApiKey` | API Key Missing | No API key is configured for
{Provider}. Add your key via the Agent Panel settings to continue. | No
API key configured for a direct provider |
| `StreamError` | Connection Interrupted | The connection to
{Provider}'s API was interrupted. Zed will retry automatically. If the
problem persists, check your network connection. | Stream dropped or I/O
error during generation |
| `InvalidApiKey` | Invalid API Key | The API key for {Provider} is
invalid or has expired. Update your key via the Agent Panel settings to
continue. | API key present but invalid or expired |
| `PermissionDenied` | Permission Denied | {Provider}'s API rejected the
request due to insufficient permissions. Check that your API key has
access to this model. | API key lacks access to the requested model |
| `RequestFailed` | Request Failed | The request could not be completed
after multiple attempts. Try again in a moment. | Upstream provider
unreachable after retries |
| `MaxOutputTokens` | Output Limit Reached | The model stopped because
it reached its maximum output length. You can ask it to continue where
it left off. | Model hit its maximum output token budget |
| `NoModelSelected` | No Model Selected | Select a model from the model
picker below to get started. | No model configured when a message is
sent |
| `ApiError` | API Error | {Provider}'s API returned an unexpected
error. If the problem persists, try switching models or restarting Zed.
## Approach

- Added typed errors (`NoModelConfiguredError`, `MaxOutputTokensError`)
where previously raw strings were used, so they can be reliably downcast
- Extended `From<anyhow::Error> for ThreadError` to downcast
`LanguageModelCompletionError` variants before falling through to the
generic `Other` case
- Each variant has a dedicated `render_*` function with appropriate
buttons (retry icon, New Thread, or none)
- Telemetry events updated with specific `kind` labels for each new
variant

Release Notes:

- Improved error messages in the agent panel to show specific,
actionable copy instead of raw provider error strings

Self-Review Checklist:

- [ x] I've reviewed my own diff for quality, security, and reliability
- [n/a] Unsafe blocks (if any) have justifying comments
- [ x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [n/a ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable


Release Notes:

Improved error messages in the agent panel to show specific, actionable
copy instead of raw provider error strings
maxbrunsfeld added a commit that referenced this pull request Apr 10, 2026
Cherry-picked PRs (in order applied):

1. #53386
2. #53400
3. #53396
4. #53428
5. #53356
6. #53215
7. #53429
8. #53458
9. #53436
10. #53451
11. #53454
12. #53419
13. #53287
14. #53521
15. #53463
16. #52848
17. #53544
18. #53556
19. #53566
20. #53579
21. #53575
22. #53550
23. #53585
24. #53510
25. #53599
26. #53099
27. #53662
28. #53660
29. #53657
30. #53654


Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Anthony Eid <anthony@zed.dev>
Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
Co-authored-by: Eric Holk <eric@zed.dev>
Co-authored-by: Anthony Eid <hello@anthonyeid.me>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Cameron Mcloughlin <cameron.studdstreet@gmail.com>
Co-authored-by: Cole Miller <cole@zed.dev>
Co-authored-by: Mikayla Maki <mikayla@zed.dev>
Co-authored-by: Anthony Eid <56899983+Anthony-Eid@users.noreply.github.com>
Co-authored-by: Katie Geer <katie@zed.dev>
Co-authored-by: ojpro <contact@ojpro.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants