Skip to content

OpenAI missing responses scope errors are surfaced as generic API errors #21928

@GuestAUser

Description

@GuestAUser

Description

When an OpenAI credential lacks api.responses.write, OpenCode stores the failure as a generic APIError with the raw provider message instead of classifying it as an auth/configuration problem.

That makes the failure look like a model/runtime issue even though the actual problem is missing Responses API permission on the credential. The UI and session history then surface a noisy raw provider error instead of actionable auth guidance.

Plugins

Built-in Codex / OpenAI OAuth integration

OpenCode version

dev (d2d5d84d1 before this fix)

Steps to reproduce

  1. Authenticate the built-in OpenAI provider with an OAuth token or restricted key that does not have api.responses.write.
  2. Start a session on an OpenAI GPT-5.x / Responses API model such as gpt-5.4.
  3. Send a prompt that triggers a normal assistant run.
  4. Observe the stored/displayed error when the provider returns 401 Missing scopes: api.responses.write.

Screenshot and/or share link

Error excerpt:

You have insufficient permissions for this operation. Missing scopes: api.responses.write.

Operating System

Linux

Terminal

N/A

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions