Skip to content

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

Open
AayushMainali-Github wants to merge 1 commit into
anomalyco:devfrom
AayushMainali-Github:provider-error-message
Open

fix(provider): extract OpenAI-shaped error messages#36411
AayushMainali-Github wants to merge 1 commit 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
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.

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

1 participant