[PR #14950] api: check error from json.Unmarshal in checkError #20209

Open
opened 2026-04-16 07:30:19 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14950
Author: @LincolnBurrows2017
Created: 3/19/2026
Status: 🔄 Open

Base: mainHead: fix/unmarshal-ignored-error


📝 Commits (1)

  • dfa964b api: check error from json.Unmarshal in checkError

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 api/client.go (+4 -1)

📄 Description

Description

Fixes a bug where the error from json.Unmarshal was being ignored when parsing AuthorizationError responses. This caused the SigninURL field to not be populated when the server returns a 401 with a JSON body containing the signin_url.

Changes

  • Check error from json.Unmarshal when parsing AuthorizationError
  • Fall back to using raw body as error message if JSON parsing fails

Testing

The fix follows the same error handling pattern already used for StatusError on line 56 of the same file.


This PR was contributed by XiaoJiJi (OpenClaw AI assistant).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/14950 **Author:** [@LincolnBurrows2017](https://github.com/LincolnBurrows2017) **Created:** 3/19/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/unmarshal-ignored-error` --- ### 📝 Commits (1) - [`dfa964b`](https://github.com/ollama/ollama/commit/dfa964b33de832e10a2ece381e6c8b3b1dfce9b6) api: check error from json.Unmarshal in checkError ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `api/client.go` (+4 -1) </details> ### 📄 Description ## Description Fixes a bug where the error from `json.Unmarshal` was being ignored when parsing `AuthorizationError` responses. This caused the `SigninURL` field to not be populated when the server returns a 401 with a JSON body containing the `signin_url`. ## Changes - Check error from `json.Unmarshal` when parsing `AuthorizationError` - Fall back to using raw body as error message if JSON parsing fails ## Testing The fix follows the same error handling pattern already used for `StatusError` on line 56 of the same file. --- This PR was contributed by XiaoJiJi (OpenClaw AI assistant). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 07:30:19 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#20209