Skip to content

fix: 5xx errors from non-standard providers are not retried #19203

Closed as not planned

Description

@okuyam2y

Description

MessageV2.fromError currently only upgrades APICallError instances to retryable APIError. When an OpenAI-compatible provider throws a plain Error or object with HTTP status fields instead, the error falls through to NamedError.Unknown, so session retry logic never runs.

Reproduction

  1. Configure a custom OpenAI-compatible provider that occasionally returns 502/503
  2. The error object may be:
    • An Error with a statusCode or status property (not APICallError)
    • A plain object with status/statusCode or response.status/response.statusCode
    • An Error whose .message is a JSON string containing statusCode
  3. OpenCode treats all of these as non-retryable Unknown errors

Expected behavior

Any error with HTTP status >= 500 should be classified as APIError with isRetryable: true, regardless of the error object shape.

4xx handling is unchanged by this fix.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 26, 2026
  2. github-actions commented on Mar 26, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If your issue is specifically about the fromError() classification gap for non-APICallError shapes with HTTP 5xx status, it may be best addressed alongside #13579.

  3. okuyam2y commented on Mar 26, 2026

    @okuyam2y
    Author

    Fix submitted in #19204.

  4. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. github-actions commented on Jul 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions