[PR #2036] [CLOSED] fix: status on errors #10766

Closed
opened 2026-04-12 23:10:07 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/2036
Author: @mxyng
Created: 1/17/2024
Status: Closed

Base: mainHead: mxyng/fix-status-code


📝 Commits (2)

📊 Changes

3 files changed (+57 additions, -20 deletions)

View changed files

📝 server/images.go (+4 -4)
📝 server/routes.go (+23 -16)
📝 server/routes_test.go (+30 -0)

📄 Description

HTTP status on errors when stream:=false is always 500 Internal Server Error because the individual errors are not handled.

$ curl -v http://127.0.0.1:11434/api/pull -d '{"name":"does-not-exist","stream":false}'
*   Trying 127.0.0.1:11434...
* Connected to 127.0.0.1 (127.0.0.1) port 11434
> POST /api/pull HTTP/1.1
> Host: 127.0.0.1:11434
> User-Agent: curl/8.4.0
> Accept: */*
> Content-Length: 40
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 500 Internal Server Error
< Content-Type: application/json
< Date: Wed, 17 Jan 2024 23:36:45 GMT
< Content-Length: 52
<
* Connection #0 to host 127.0.0.1 left intact
{"error":"pull model manifest: file does not exist"}

The most common errors are:

  • pull, push: pulling or pushing a model that doesn't exist should return 404 Not Found
  • push: pushing a model into a place the user is authorized to should return 401 Unauthorized

🔄 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/2036 **Author:** [@mxyng](https://github.com/mxyng) **Created:** 1/17/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `mxyng/fix-status-code` --- ### 📝 Commits (2) - [`0bd5245`](https://github.com/ollama/ollama/commit/0bd5245acf129efa2b730444731cf9ba9f776f7b) fix: status on errors - [`5c17743`](https://github.com/ollama/ollama/commit/5c17743b2c2f8ecb1c3db52a61c09163942c866a) remove json stream errors ### 📊 Changes **3 files changed** (+57 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `server/images.go` (+4 -4) 📝 `server/routes.go` (+23 -16) 📝 `server/routes_test.go` (+30 -0) </details> ### 📄 Description HTTP status on errors when stream:=false is always 500 Internal Server Error because the individual errors are not handled. ``` $ curl -v http://127.0.0.1:11434/api/pull -d '{"name":"does-not-exist","stream":false}' * Trying 127.0.0.1:11434... * Connected to 127.0.0.1 (127.0.0.1) port 11434 > POST /api/pull HTTP/1.1 > Host: 127.0.0.1:11434 > User-Agent: curl/8.4.0 > Accept: */* > Content-Length: 40 > Content-Type: application/x-www-form-urlencoded > < HTTP/1.1 500 Internal Server Error < Content-Type: application/json < Date: Wed, 17 Jan 2024 23:36:45 GMT < Content-Length: 52 < * Connection #0 to host 127.0.0.1 left intact {"error":"pull model manifest: file does not exist"} ``` The most common errors are: - pull, push: pulling or pushing a model that doesn't exist should return 404 Not Found - push: pushing a model into a place the user is authorized to should return 401 Unauthorized --- <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-12 23:10:08 -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#10766