ollama - 💡(How to fix) Fix web_search/web_fetch return 200 OK with empty body when Cloud usage is exhausted

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

When usage/quota is exhausted, the API should return a non-2xx status and JSON error body, for example: {"error":"weekly usage limit exceeded"} after checking response.ok. Since the response is 200 OK but body is empty, clients see a misleading parse error instead of a quota/usage error.

Root Cause

This breaks integrations such as @ollama/pi-web-search, because it calls:

Code Example

HTTP/2 200
content-type: application/json
content-length: 0

---

Unexpected end of JSON input

---

HTTP/2 429
content-type: application/json

{"error":"weekly usage limit exceeded"}

---

POST https://ollama.com/api/web_search
HTTP 200
content-type: application/json
content-length: 0
x-request-id: 5710814b-5072-4ae4-b6e9-a55bdad29d26
body: <empty>

POST https://ollama.com/api/web_fetch
HTTP 200
content-type: application/json
content-length: 0
x-request-id: a0d006e3-c948-4388-96e1-81ce53e42b1a
body: <empty>

---

curl -i http://127.0.0.1:11434/api/experimental/web_fetch \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com"}'

---

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 0

---

Weekly usage: 100% used

---

curl -i https://ollama.com/api/web_search \
  -H "Authorization: Bearer $OLLAMA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"query":"what is ollama?","max_results":1}'

---

curl -i https://ollama.com/api/web_fetch \
  -H "Authorization: Bearer $OLLAMA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com"}'

---

const data = await response.json()
RAW_BUFFERClick to expand / collapse

What is the issue?

When Ollama Cloud weekly usage is exhausted, the Web Search / Web Fetch APIs return:

HTTP/2 200
content-type: application/json
content-length: 0

with an empty body.

This causes clients that correctly expect JSON from these endpoints to fail with JSON parse errors, e.g.:

Unexpected end of JSON input

This was observed both through the local experimental proxy endpoints and by calling the cloud API directly with an API key.

Expected behavior

When usage/quota is exhausted, the API should return a non-2xx status and JSON error body, for example:

HTTP/2 429
content-type: application/json

{"error":"weekly usage limit exceeded"}

or 402 if that is the intended billing/credits status.

Actual behavior

Direct cloud API calls return empty 200 OK responses:

POST https://ollama.com/api/web_search
HTTP 200
content-type: application/json
content-length: 0
x-request-id: 5710814b-5072-4ae4-b6e9-a55bdad29d26
body: <empty>

POST https://ollama.com/api/web_fetch
HTTP 200
content-type: application/json
content-length: 0
x-request-id: a0d006e3-c948-4388-96e1-81ce53e42b1a
body: <empty>

The local proxy endpoint shows the same behavior:

curl -i http://127.0.0.1:11434/api/experimental/web_fetch \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com"}'

returns:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 0

Reproduction

With an account whose Cloud Usage page shows:

Weekly usage: 100% used

run:

curl -i https://ollama.com/api/web_search \
  -H "Authorization: Bearer $OLLAMA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"query":"what is ollama?","max_results":1}'

and:

curl -i https://ollama.com/api/web_fetch \
  -H "Authorization: Bearer $OLLAMA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com"}'

Impact

This breaks integrations such as @ollama/pi-web-search, because it calls:

const data = await response.json()

after checking response.ok. Since the response is 200 OK but body is empty, clients see a misleading parse error instead of a quota/usage error.

Environment

  • Ollama: 0.23.2
  • OS: macOS
  • Account plan: Free
  • Cloud usage: weekly usage exhausted (100% used)

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

When usage/quota is exhausted, the API should return a non-2xx status and JSON error body, for example:

HTTP/2 429
content-type: application/json

{"error":"weekly usage limit exceeded"}

or 402 if that is the intended billing/credits status.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING