issue: Error if Application Header is not set to json when using API #138

Closed
opened 2026-02-15 17:15:17 -05:00 by yindo · 3 comments
Owner

Originally created by @maurerle on GitHub (Dec 8, 2025).

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

v0.6.41

Ollama Version (if applicable)

v0.13.0

Operating System

Debian 13

Browser (if applicable)

Firefox

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

Using:

curl -H "Authorization: Bearer XXX" http://localhost:8080/ollama/api/generate -d '{
 "model": "mistral:latest",
 "prompt": "Why is the sky blue?"
}'

should work fine as it is specified in the docs:
https://docs.openwebui.com/getting-started/api-endpoints/#-generate-completion-streaming

Actual Behavior

{"detail":[{"type":"model_attributes_type","loc":["body"],"msg":"Input should be a valid dictionary or object to extract fields from","input":"{\n \"model\": \"mistral:latest\",\n \"prompt\": \"Why is the sky blue?\"\n}"}]}% error

Only adding -H 'Content-Type: application/json'

curl -H 'Content-Type: application/json' -H "Authorization: Bearer XXX" http://localhost:8080/ollama/api/generate -d '{
 "model": "mistral:latest",
 "prompt": "Why is the sky blue?"
}'

works

Steps to Reproduce

  1. run the example from the docs using the local ollama api through open-webui as specified here:
    https://docs.openwebui.com/getting-started/api-endpoints/#-generate-completion-streaming
  2. see the error
  3. unhappy

Logs & Screenshots

given above

Additional Information

No response

Originally created by @maurerle on GitHub (Dec 8, 2025). ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version v0.6.41 ### Ollama Version (if applicable) v0.13.0 ### Operating System Debian 13 ### Browser (if applicable) Firefox ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior Using: ``` curl -H "Authorization: Bearer XXX" http://localhost:8080/ollama/api/generate -d '{ "model": "mistral:latest", "prompt": "Why is the sky blue?" }' ``` should work fine as it is specified in the docs: https://docs.openwebui.com/getting-started/api-endpoints/#-generate-completion-streaming ### Actual Behavior `{"detail":[{"type":"model_attributes_type","loc":["body"],"msg":"Input should be a valid dictionary or object to extract fields from","input":"{\n \"model\": \"mistral:latest\",\n \"prompt\": \"Why is the sky blue?\"\n}"}]}%` error Only adding `-H 'Content-Type: application/json'` ``` curl -H 'Content-Type: application/json' -H "Authorization: Bearer XXX" http://localhost:8080/ollama/api/generate -d '{ "model": "mistral:latest", "prompt": "Why is the sky blue?" }' ``` works ### Steps to Reproduce 1. run the example from the docs using the local ollama api through open-webui as specified here: https://docs.openwebui.com/getting-started/api-endpoints/#-generate-completion-streaming 2. see the error 3. unhappy ### Logs & Screenshots given above ### Additional Information _No response_
yindo added the bug label 2026-02-15 17:15:17 -05:00
yindo closed this issue 2026-02-15 17:15:17 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Dec 8, 2025):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #19755 issue: Error: 404, message='Not Found', url='http://ollama:11434/api/embed'
    by stevewillett • Dec 04, 2025 • bug

  2. #19777 issue:
    by Yaute7 • Dec 05, 2025 • bug

  3. #19563 issue:
    by naruto7g • Nov 28, 2025 • bug

  4. #19230 issue: Open WebUI 0.6.36 Unexpected token 'd', "data: {"id"... is not valid JSON returned.
    by abhijit4law • Nov 17, 2025 • bug

  5. #19017 issue: OPENAI_API_CONFIGS and OLLAMA_API_CONFIGS environment variables are not parsed from JSON
    by runixer • Nov 07, 2025 • bug

Show 5 more related issues
  1. #19211 issue:
    by Byrnes9 • Nov 16, 2025 • bug

  2. #19417 issue: v0.6.37 SQL Error
    by AKHYP • Nov 24, 2025 • bug

  3. #15911 issue: Tools : JSON malformed
    by chdid • Jul 21, 2025 • bug

  4. #14908 issue: 401 x-api-key header is required web search
    by deresolution20 • Jun 11, 2025 • bug

  5. #19496 issue: 500 internal server error appears in v0.6.40
    by cloudtuotuo • Nov 26, 2025 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

@owui-terminator[bot] commented on GitHub (Dec 8, 2025): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#19755](https://github.com/open-webui/open-webui/issues/19755) **issue: Error: 404, message='Not Found', url='http://ollama:11434/api/embed'** *by stevewillett • Dec 04, 2025 • `bug`* 2. [#19777](https://github.com/open-webui/open-webui/issues/19777) **issue:** *by Yaute7 • Dec 05, 2025 • `bug`* 3. [#19563](https://github.com/open-webui/open-webui/issues/19563) **issue:** *by naruto7g • Nov 28, 2025 • `bug`* 4. [#19230](https://github.com/open-webui/open-webui/issues/19230) **issue: Open WebUI 0.6.36 Unexpected token 'd', "data: {"id"... is not valid JSON returned.** *by abhijit4law • Nov 17, 2025 • `bug`* 5. [#19017](https://github.com/open-webui/open-webui/issues/19017) **issue: OPENAI_API_CONFIGS and OLLAMA_API_CONFIGS environment variables are not parsed from JSON** *by runixer • Nov 07, 2025 • `bug`* <details> <summary>Show 5 more related issues</summary> 6. [#19211](https://github.com/open-webui/open-webui/issues/19211) **issue:** *by Byrnes9 • Nov 16, 2025 • `bug`* 7. [#19417](https://github.com/open-webui/open-webui/issues/19417) **issue: v0.6.37 SQL Error** *by AKHYP • Nov 24, 2025 • `bug`* 8. [#15911](https://github.com/open-webui/open-webui/issues/15911) **issue: Tools : JSON malformed** *by chdid • Jul 21, 2025 • `bug`* 9. [#14908](https://github.com/open-webui/open-webui/issues/14908) **issue: 401 x-api-key header is required web search** *by deresolution20 • Jun 11, 2025 • `bug`* 10. [#19496](https://github.com/open-webui/open-webui/issues/19496) **issue: 500 internal server error appears in v0.6.40** *by cloudtuotuo • Nov 26, 2025 • `bug`* </details> --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Author
Owner

@tjbck commented on GitHub (Dec 8, 2025):

Intended, @silentoplayz our docs should be updated.

@tjbck commented on GitHub (Dec 8, 2025): Intended, @silentoplayz our docs should be updated.
Author
Owner

@Classic298 commented on GitHub (Dec 20, 2025):

edited docs\getting-started\api-endpoints.md in dev

@Classic298 commented on GitHub (Dec 20, 2025): edited docs\getting-started\api-endpoints.md in dev
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-webui/docs#138