[GH-ISSUE #24929] issue: Selecting a skill ($) without additional text sends empty user message, causing API errors #123744

Open
opened 2026-05-21 03:14:08 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @JustinJohnWilliams on GitHub (May 19, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24929

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.9.5

Ollama Version (if applicable)

N/A

Operating System

Amazon Linux 2023 (ECS Fargate) / macOS Sequoia (reproducible on both)

Browser (if applicable)

Chrome 136

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.

Expected Behavior

When a user selects a skill via $skill-name in the chat composer and sends the message without typing additional text, the message should either:

  1. Include a minimal non-empty user message (e.g., a space or the skill name) so the API call succeeds, or
  2. The UI should prevent submission when the user message would be empty after skill mention stripping

The skill's system prompt injection should be sufficient context for the model to respond.

Actual Behavior

After strip_skill_mentions() removes the <$skillId|label> tag from the user message content, the resulting message is an empty string "". This empty content block is sent to the model API, which causes a 400 ValidationException on providers that reject empty content blocks (e.g., AWS Bedrock ConverseStream API):

400: An error occurred (ValidationException) when calling the ConverseStream operation:
The text field in the ContentBlock object at messages.40.content.0 is blank.
Add text to the text field, and try again.

Steps to Reproduce

  1. Install Open WebUI v0.9.5 via Docker (ghcr.io/open-webui/open-webui:v0.9.5)
  2. Connect to any AWS Bedrock model via an OpenAI-compatible proxy (e.g., bedrock-access-gateway)
  3. Create a skill in Workspace > Skills (any content, e.g., "You are a helpful assistant that specializes in data analysis.")
  4. In a new chat, type $ and select the skill from the autocomplete dropdown
  5. Without typing any additional text, press Enter / click Send
  6. Observe the ValidationException error

Root Cause

In backend/open_webui/utils/middleware.py line 2587:

# Strip <$skillId|label> mention tags so the model doesn't see raw markup.
strip_skill_mentions(form_data.get('messages', []))

The strip_skill_mentions() function (line 2225) removes the <$...|...> tags and .strip()s the result. If the user only selected a skill and typed nothing else, this produces an empty string. There is no guard after this point to handle the empty message case before it's sent to the model.

Filters and pipelines cannot address this because they execute before strip_skill_mentions() runs (line 2464 vs. 2587).

Suggested Fix

After strip_skill_mentions() on line 2587, check if the last user message is empty and set a minimal default:

strip_skill_mentions(form_data.get('messages', []))

# Ensure user message is not empty after skill mention stripping
prompt = get_last_user_message(form_data['messages'])
if prompt is not None and not prompt.strip():
    replace_last_user_message(form_data['messages'], '.')

Alternatively, the frontend could prevent form submission when the editor content consists solely of a skill mention node with no other text.

Logs & Screenshots

400: An error occurred (ValidationException) when calling the ConverseStream operation:
The text field in the ContentBlock object at messages.40.content.0 is blank.
Add text to the text field, and try again.

No relevant browser console errors — the error is returned from the backend API response.

Additional Information

Related issues:

  • #17202 — Same root cause (empty user message) but triggered by file upload without text. Closed without an upstream fix.
  • #21457 — File context not used when no user message entered but system prompt exists.
  • #23950 — Skills not injected in persisted chats (related skill mention parsing).

Environment details:

  • Backend: AWS Bedrock via bedrock-access-gateway (OpenAI-compatible proxy)
  • Models tested: Claude Sonnet 4.6, Claude Opus 4.6 (all Bedrock models reject empty content blocks)
  • This likely affects any provider whose API validates against empty content blocks
Originally created by @JustinJohnWilliams on GitHub (May 19, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/24929 ### 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.9.5 ### Ollama Version (if applicable) N/A ### Operating System Amazon Linux 2023 (ECS Fargate) / macOS Sequoia (reproducible on both) ### Browser (if applicable) Chrome 136 ### 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**. ### Expected Behavior When a user selects a skill via `$skill-name` in the chat composer and sends the message without typing additional text, the message should either: 1. Include a minimal non-empty user message (e.g., a space or the skill name) so the API call succeeds, or 2. The UI should prevent submission when the user message would be empty after skill mention stripping The skill's system prompt injection should be sufficient context for the model to respond. ### Actual Behavior After `strip_skill_mentions()` removes the `<$skillId|label>` tag from the user message content, the resulting message is an empty string `""`. This empty content block is sent to the model API, which causes a `400 ValidationException` on providers that reject empty content blocks (e.g., AWS Bedrock ConverseStream API): ``` 400: An error occurred (ValidationException) when calling the ConverseStream operation: The text field in the ContentBlock object at messages.40.content.0 is blank. Add text to the text field, and try again. ``` ### Steps to Reproduce 1. Install Open WebUI v0.9.5 via Docker (`ghcr.io/open-webui/open-webui:v0.9.5`) 2. Connect to any AWS Bedrock model via an OpenAI-compatible proxy (e.g., [bedrock-access-gateway](https://github.com/aws-samples/bedrock-access-gateway)) 3. Create a skill in Workspace > Skills (any content, e.g., "You are a helpful assistant that specializes in data analysis.") 4. In a new chat, type `$` and select the skill from the autocomplete dropdown 5. Without typing any additional text, press Enter / click Send 6. Observe the `ValidationException` error ### Root Cause In [`backend/open_webui/utils/middleware.py` line 2587](https://github.com/open-webui/open-webui/blob/main/backend/open_webui/utils/middleware.py#L2587): ```python # Strip <$skillId|label> mention tags so the model doesn't see raw markup. strip_skill_mentions(form_data.get('messages', [])) ``` The [`strip_skill_mentions()` function (line 2225)](https://github.com/open-webui/open-webui/blob/main/backend/open_webui/utils/middleware.py#L2225) removes the `<$...|...>` tags and `.strip()`s the result. If the user only selected a skill and typed nothing else, this produces an empty string. There is no guard after this point to handle the empty message case before it's sent to the model. Filters and pipelines cannot address this because they execute *before* `strip_skill_mentions()` runs (line 2464 vs. 2587). ### Suggested Fix After `strip_skill_mentions()` on line 2587, check if the last user message is empty and set a minimal default: ```python strip_skill_mentions(form_data.get('messages', [])) # Ensure user message is not empty after skill mention stripping prompt = get_last_user_message(form_data['messages']) if prompt is not None and not prompt.strip(): replace_last_user_message(form_data['messages'], '.') ``` Alternatively, the frontend could prevent form submission when the editor content consists solely of a skill mention node with no other text. ### Logs & Screenshots ``` 400: An error occurred (ValidationException) when calling the ConverseStream operation: The text field in the ContentBlock object at messages.40.content.0 is blank. Add text to the text field, and try again. ``` No relevant browser console errors — the error is returned from the backend API response. ### Additional Information **Related issues:** - #17202 — Same root cause (empty user message) but triggered by file upload without text. Closed without an upstream fix. - #21457 — File context not used when no user message entered but system prompt exists. - #23950 — Skills not injected in persisted chats (related skill mention parsing). **Environment details:** - Backend: AWS Bedrock via [bedrock-access-gateway](https://github.com/aws-samples/bedrock-access-gateway) (OpenAI-compatible proxy) - Models tested: Claude Sonnet 4.6, Claude Opus 4.6 (all Bedrock models reject empty content blocks) - This likely affects any provider whose API validates against empty content blocks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#123744