mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[GH-ISSUE #10000] SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON #15729
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @LuyiTian on GitHub (Feb 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/10000
Bug Report
I have noticed relevant discussion and issue here.
https://github.com/open-webui/open-webui/issues/9635
https://github.com/open-webui/open-webui/issues/9404
https://github.com/open-webui/open-webui/discussions/9446
I use openresty (ran in docker) to build reverse proxy between my OpenWebUI and a public url. So I increased the timeout and used all the method mentioned in the above page. but non of them works.
I have noticed although these issues all report the
SyntaxError. the content of the error is different. for me it is always<!DOCTYPEInstallation Method
Docker
Environment
Open WebUI Version: [ v0.5.10]
Ollama (if applicable): not usieng Olllama
Operating System: [ Ubuntu 24.04 remote server]
Browser (if applicable): [Chrome, but the same in other browsers
Confirmation:
Expected Behavior:
[Describe what you expected to happen.]
Actual Behavior:
When use webserach with long context, I sometimes got this error:
SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
Description
Reproduction Details
Steps to Reproduce:
it does not always happen but when I enable web search with long context the chance of error occuring is much higher
Logs and Screenshots
Docker Container Logs:
I opened the broswer and the docker log winder side by side. and interestly, when the error occurs in my chat window, I can see this log appear in the docker logs:
INFO: 2403:4a00:4001:13:115:115:5698:1a2c:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK
Screenshots/Screen Recordings (if applicable):
Additional Information
If I wait for a while, it still generate the answer as usual. However I cannot start the next round conversion in the same thread because it will say there are syntax error in previous round
Note
@silentoplayz commented on GitHub (Feb 14, 2025):
Related - https://github.com/open-webui/open-webui/discussions/10022
@sirBdone commented on GitHub (Feb 14, 2025):
Yes, I've been having a problem with this too. I also receive HTML instead of JSON when I hit searxng:8080 or host.docker.internal:8080 from the ollama container to the searxng container (both on traefik-net) which serves my ai page on ssl (working fine). I only want searxng open to localhost system or the ollama container, not the web.
I can get http://localhost:8080 to bring up the Searxng search page and work properly. i can do a search like http://localhost:8080/search?q=dogs&format=json and get a full page of json.
example:
So, if I get ollama webui to "search the web" with websearch.py in the tools, and tell it to mirror its context I give it (which should be json from the search), it shows me http://example.com/search?q=dogs&format=json, 404 error. and then tells me it can't find the answer in the context. On docker Logs, I see it give the paragraph for websearch and webscrape, but then an error about JSON not being found.
So, I go to the ollama-openwebui container and do curl http://searxng:8080/search?q=dogs&format=json and it returns to me the html of the results page, not JSON as above, which is a single string. I've seen this similar issue in Searxng and WebUI's github over the last several versions, because new commits are retroactively breaking its functionality, then it's fixed again or not idk, it's not working for me and I believe I have it set up right. I'd really like to figure this out. Today, is V-day so I'll be very busy later today, but I am very eager to work with someone to help fix this issue.
I would say the problem is searxng because it's returning HTML to ollama when it should be returning JSON, but when I do that in the browser of the computer with localhost, its returning the proper JSON results.