Skip to content

fix: throw error on token refresh failure instead of returning undefined#5

Merged
rekram1-node merged 1 commit intoanomalyco:mainfrom
kavhnr:fix/token-refresh-error
Dec 8, 2025
Merged

fix: throw error on token refresh failure instead of returning undefined#5
rekram1-node merged 1 commit intoanomalyco:mainfrom
kavhnr:fix/token-refresh-error

Conversation

@kavhnr
Copy link
Copy Markdown
Contributor

@kavhnr kavhnr commented Nov 26, 2025

Fixes anomalyco/opencode#2012

When token refresh fails, the custom fetch returns undefined instead of throwing. This causes TypeError: undefined is not an object (evaluating 'response.headers') in the AI SDK.

This change throws an error instead, which opencode's retry logic handles automatically.

@rekram1-node rekram1-node merged commit 1f65090 into anomalyco:main Dec 8, 2025
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.

TypeError: undefined is not an object (evaluating 'response.headers')

2 participants