[PR #14838] fix: Handle json.Unmarshal error in checkError function #14868

Open
opened 2026-04-13 01:04:25 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

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

Base: mainHead: fix-auth-error-handling


📝 Commits (2)

  • c48be94 fix: correct typo ViewSeperator -> ViewSeparator in deepseekocr model
  • 50b191e fix: use consistent binary units (TiB/GiB/MiB/KiB) in HumanBytes

📊 Changes

3 files changed (+42 additions, -35 deletions)

View changed files

📝 format/bytes.go (+15 -12)
📝 format/bytes_test.go (+25 -20)
📝 model/models/deepseekocr/model.go (+2 -3)

📄 Description

Summary

In api/client.go line 50, the json.Unmarshal error was silently ignored when handling HTTP 401 Unauthorized responses.

Fix

Added proper error handling:

if err := json.Unmarshal(body, &authError); err != nil {
    authError.Status = string(body)
}

This matches the error handling pattern used for StatusError on line 56.


🔄 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/14838 **Author:** [@LincolnBurrows2017](https://github.com/LincolnBurrows2017) **Created:** 3/14/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-auth-error-handling` --- ### 📝 Commits (2) - [`c48be94`](https://github.com/ollama/ollama/commit/c48be94ac71ffe697cb92e7ca4b8eecd6d93826b) fix: correct typo ViewSeperator -> ViewSeparator in deepseekocr model - [`50b191e`](https://github.com/ollama/ollama/commit/50b191edede819049e59fa6ce791054942360ab8) fix: use consistent binary units (TiB/GiB/MiB/KiB) in HumanBytes ### 📊 Changes **3 files changed** (+42 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `format/bytes.go` (+15 -12) 📝 `format/bytes_test.go` (+25 -20) 📝 `model/models/deepseekocr/model.go` (+2 -3) </details> ### 📄 Description ## Summary In `api/client.go` line 50, the `json.Unmarshal` error was silently ignored when handling HTTP 401 Unauthorized responses. ## Fix Added proper error handling: ```go if err := json.Unmarshal(body, &authError); err != nil { authError.Status = string(body) } ``` This matches the error handling pattern used for `StatusError` on line 56. --- <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-13 01:04:25 -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#14868