Fix lost error messages when listing OpenRouter models (#58502)

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

`list_models` reads the response body once up front, then the error
branch read it
*again* into a shadowing `body`. Since the stream was already drained,
the second read
returned `""`, so error parsing always failed and we surfaced an empty
message instead
of the real API error.

This removes the redundant second read so the error branch uses the body
we already have.

Release Notes:

- Fixed OpenRouter API errors showing empty messages when fetching the
model list

Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
af264433a9Zhiwei Liang committed on 6/4/2026, 11:18:14 AM· committed by GitHubparent5366733
1 file changedLine totals unavailable