Cannot Search Chat History due to PostgreSQL not accepting null values of \u0000 #3564

Closed
opened 2025-11-11 15:34:00 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @mobilestack on GitHub (Feb 4, 2025).

Installation Method

Docker with main tag, and Postgres docker as database

Environment

  • Open WebUI Version: 0.5.7

  • Ollama (if applicable): not used

  • Operating System: Ubuntu 22.04.5 LTS

  • Browser (if applicable): Chrome 132.0.6834.160

Confirmation:

  • [x ] I have read and followed all the instructions provided in the README.md.
  • [ x] I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • [x ] I have included the Docker container logs.
  • [x ] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

When searching history result, matched items should appear

Actual Behavior:

Cannot see searched result, with the indicator spinning and waiting.

Description

Bug Summary:

During search, the underlying SQL cannot execute correctly for \u0000.

Reproduction Details

Steps to Reproduce:
[Outline the steps to reproduce the bug. Be as detailed as possible.]

Logs and Screenshots

Browser Console Logs:

Docker Container Logs:

Error from docker logs of Postgres, showing a search attempt failed.

SELECT chat.id AS chat_id, chat.user_id AS chat_user_id, chat.title AS chat_title, chat.chat AS chat_chat, chat.created_at AS chat_created_at, chat.updated_at AS chat_updated_at, chat.share_id AS chat_share_id, chat.archived AS chat_archived, chat.pinned AS chat_pinned, chat.meta AS chat_meta, chat.folder_id AS chat_folder_id
	FROM chat
	WHERE chat.user_id = '4b54a4b3-8097-45c2-978c-938dea762fc1' AND chat.archived = false AND (chat.title ILIKE '%ue%' OR
	                            EXISTS (
	                                SELECT 1
	                                FROM json_array_elements(Chat.chat->'messages') AS message
	                                WHERE LOWER(message->>'content') LIKE '%' || 'ue' || '%'
	                            )
	                            ) ORDER BY chat.updated_at DESC
	 LIMIT 60 OFFSET 0

showing something like

ERROR: unsupported Unicode escape sequence 
SQL status:22P05

DETAILS: \u0000 cannot be converted to text.

CONTEXT: JSON data, line 1: ...Ii, "role": "assistant", "content":
"\u0002\u0000.

I do have found \u0000 in my chatting history.

Screenshots/Screen Recordings (if applicable):

Additional Information

I think there might be a module to filter input to Postgres database. But not sure whether it is available.
I could contribute to this part if needed.

Originally created by @mobilestack on GitHub (Feb 4, 2025). ## Installation Method Docker with main tag, and Postgres docker as database ## Environment - **Open WebUI Version:** 0.5.7 - **Ollama (if applicable):** not used - **Operating System:** Ubuntu 22.04.5 LTS - **Browser (if applicable):** Chrome 132.0.6834.160 **Confirmation:** - [x ] I have read and followed all the instructions provided in the README.md. - [ x] I am on the latest version of both Open WebUI and Ollama. - [ ] I have included the browser console logs. - [x ] I have included the Docker container logs. - [x ] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: When searching history result, matched items should appear ## Actual Behavior: Cannot see searched result, with the indicator spinning and waiting. ## Description **Bug Summary:** During search, the underlying SQL cannot execute correctly for \u0000. ## Reproduction Details **Steps to Reproduce:** [Outline the steps to reproduce the bug. Be as detailed as possible.] ## Logs and Screenshots **Browser Console Logs:** **Docker Container Logs:** Error from docker logs of Postgres, showing a search attempt failed. ``` SELECT chat.id AS chat_id, chat.user_id AS chat_user_id, chat.title AS chat_title, chat.chat AS chat_chat, chat.created_at AS chat_created_at, chat.updated_at AS chat_updated_at, chat.share_id AS chat_share_id, chat.archived AS chat_archived, chat.pinned AS chat_pinned, chat.meta AS chat_meta, chat.folder_id AS chat_folder_id FROM chat WHERE chat.user_id = '4b54a4b3-8097-45c2-978c-938dea762fc1' AND chat.archived = false AND (chat.title ILIKE '%ue%' OR EXISTS ( SELECT 1 FROM json_array_elements(Chat.chat->'messages') AS message WHERE LOWER(message->>'content') LIKE '%' || 'ue' || '%' ) ) ORDER BY chat.updated_at DESC LIMIT 60 OFFSET 0 ``` showing something like ``` ERROR: unsupported Unicode escape sequence SQL status:22P05 DETAILS: \u0000 cannot be converted to text. CONTEXT: JSON data, line 1: ...Ii, "role": "assistant", "content": "\u0002\u0000. ``` I do have found \u0000 in my chatting history. **Screenshots/Screen Recordings (if applicable):** ## Additional Information I think there might be a module to filter input to Postgres database. But not sure whether it is available. I could contribute to this part if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#3564