Skip to content

Conversation

@JoshFerge
Copy link
Member

@JoshFerge JoshFerge commented Jan 14, 2026

Summary

  • When coding agent integrations (like Cursor) return API errors, the error message shown to users is now more helpful
  • For 401 errors: Failed to make request to coding agent (https://api.cursor.com/v0/agents). Please check that your API credentials are correct: 401 Error: {"code":"internal","message":"Error"}
  • For other errors: Failed to make request to coding agent (https://api.example.com). 500 Error: Some error message
  • URL is included when available

Test plan

  • Added unit test for 401 ApiError (includes credentials hint and URL)
  • Added unit test for non-401 ApiError (includes status code)
  • All existing tests pass

🤖 Generated with Claude Code

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 14, 2026
@JoshFerge JoshFerge force-pushed the jferg/improve-coding-agent-error-messages branch from 1c92157 to 813bc9e Compare January 14, 2026 16:43
@JoshFerge JoshFerge marked this pull request as ready for review January 14, 2026 16:50
@JoshFerge JoshFerge requested a review from a team as a code owner January 14, 2026 16:50
@JoshFerge JoshFerge enabled auto-merge (squash) January 14, 2026 16:53
When the Cursor API (or other coding agent integrations) return an error,
the error message shown to users only contained the response body text.
This made it difficult to understand the nature of the error.

Now, ApiError failures show:
- For 401 errors: "Failed to make request to coding agent (URL). Please check that your API credentials are correct: 401 Error: <response>"
- For other errors: "Failed to make request to coding agent (URL). <code> Error: <response>"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@JoshFerge JoshFerge force-pushed the jferg/improve-coding-agent-error-messages branch from 9b9d922 to 4ba43f7 Compare January 14, 2026 16:55
if e.code == 401:
error_message = f"Failed to make request to coding agent{url_part}. Please check that your API credentials are correct: {e.code} Error: {e.text}"
else:
error_message = f"Failed to make request to coding agent{url_part}. {e.code} Error: {e.text}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Error message shows "None Error:" when code is missing

Low Severity

When ApiError is raised without a status code (which happens in several places in the codebase like "Internal Error" or "Connection broken" errors), e.code will be None. The formatted error message will then display "None Error: ..." which is confusing and less helpful than the original str(e) behavior. The code doesn't handle the case where code is None.

Fix in Cursor Fix in Web

@JoshFerge JoshFerge merged commit a679615 into master Jan 14, 2026
66 checks passed
@JoshFerge JoshFerge deleted the jferg/improve-coding-agent-error-messages branch January 14, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants