Skip to content

fix(provider): extract OpenAI-shaped error messages - #36411

Closed
AayushMainali-Github wants to merge 2 commits into
anomalyco:devfrom
AayushMainali-Github:provider-error-message
Closed

fix(provider): extract OpenAI-shaped error messages#36411
AayushMainali-Github wants to merge 2 commits into
anomalyco:devfrom
AayushMainali-Github:provider-error-message

Conversation

@AayushMainali-Github

Copy link
Copy Markdown

Issue for this PR

Closes#36410

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Provider error parsing used body.message || body.error || body.error?.message. For OpenAI-shaped bodies, body.error is an object, so the real error.message was skipped and users got a generic status line or raw JSON.

Extraction now prefers string message / error / error.message fields. Added unit tests for the OpenAI object shape and string error.

How did you verify your code works?

Ran bun test test/provider/error.test.ts in packages/opencode.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

OpenAI-compatible bodies put the text under error.message, but parsing
grabbed the error object first and dropped the real message.
CreatorGhost added a commit to CreatorGhost/TheCode that referenced this pull request Jul 12, 2026
CreatorGhost added a commit to CreatorGhost/TheCode that referenced this pull request Jul 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provider errors shaped like OpenAI { error: { message } } skip the real message

1 participant

@AayushMainali-Github