ce9f4f2 fix: avoid empty prompt for skill-only messages
📊 Changes
1 file changed (+34 additions, -15 deletions)
View changed files
📝backend/open_webui/utils/middleware.py (+34 -15)
📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is a small bug fix for an existing issue.
Before submitting, make sure you've checked the following:
Linked Issue/Discussion: This PR references an existing Issue or Discussion — Closes#24929.
Target branch: The pull request targets the dev branch.
Description: A concise description of the changes is provided below.
Changelog: A changelog entry following Keep a Changelog format is included at the bottom.
Documentation: Not applicable; backend bug fix only.
Dependencies: Not applicable; no dependency changes.
Testing: Manual tests have been performed to verify the fix/feature works correctly and does not introduce regressions.
No Unchecked AI Code: This PR has undergone review and manual validation.
Self-Review: A self-review of the code has been performed.
Architecture: Uses a narrow backend guard after skill mention stripping; no settings added.
Git Hygiene: The PR is atomic, based on dev, and contains no unrelated commits.
Title Prefix: The PR title uses the fix prefix.
Changelog Entry
Description
Prevents provider API errors when a user submits only a selected skill mention and no additional text.
Added
A neutral non-empty fallback for selected-skill messages whose selected skill is no longer active or available.
Changed
Skill-only user messages now receive a small fallback prompt after <$skill|label> mention stripping, so strict providers do not receive a blank final user message.
Deprecated
None.
Removed
None.
Fixed
Fixed skill-only chat submissions producing an empty user message after backend skill mention stripping.
Fixed the inactive/unavailable selected-skill edge case so it also cannot leave the final user message blank.
This replaces #24968, which was closed because the PR body did not include the required CLA template text. The code also addresses the Copilot review edge case from that PR: if the selected skill is inactive or unavailable, the backend still inserts a neutral non-empty fallback instead of allowing an empty content block through.
uvx ruff format --check backend/open_webui/utils/middleware.py
git diff --check
Note: uvx ruff check backend/open_webui/utils/middleware.py still reports pre-existing import, complexity, and line-length issues across this large file that are unrelated to this change.
Screenshots or Videos
Not applicable; backend request-shaping fix.
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/24971
**Author:** [@pragnyanramtha](https://github.com/pragnyanramtha)
**Created:** 5/21/2026
**Status:** 🔄 Open
**Base:** `dev` ← **Head:** `pragnyan/fix-empty-skill-only-message-24929-v2`
---
### 📝 Commits (1)
- [`ce9f4f2`](https://github.com/open-webui/open-webui/commit/ce9f4f2b593b3de85f77992b0e1b4442bd51c7ff) fix: avoid empty prompt for skill-only messages
### 📊 Changes
**1 file changed** (+34 additions, -15 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/utils/middleware.py` (+34 -15)
</details>
### 📄 Description
# Pull Request Checklist
### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is a small bug fix for an existing issue.
**Before submitting, make sure you've checked the following:**
- [x] **Linked Issue/Discussion:** This PR references an existing Issue or Discussion — Closes #24929.
- [x] **Target branch:** The pull request targets the `dev` branch.
- [x] **Description:** A concise description of the changes is provided below.
- [x] **Changelog:** A changelog entry following Keep a Changelog format is included at the bottom.
- [ ] **Documentation:** Not applicable; backend bug fix only.
- [ ] **Dependencies:** Not applicable; no dependency changes.
- [x] **Testing:** Manual tests have been performed to verify the fix/feature works correctly and does not introduce regressions.
- [x] **No Unchecked AI Code:** This PR has undergone review and manual validation.
- [x] **Self-Review:** A self-review of the code has been performed.
- [x] **Architecture:** Uses a narrow backend guard after skill mention stripping; no settings added.
- [x] **Git Hygiene:** The PR is atomic, based on `dev`, and contains no unrelated commits.
- [x] **Title Prefix:** The PR title uses the `fix` prefix.
# Changelog Entry
### Description
- Prevents provider API errors when a user submits only a selected skill mention and no additional text.
### Added
- A neutral non-empty fallback for selected-skill messages whose selected skill is no longer active or available.
### Changed
- Skill-only user messages now receive a small fallback prompt after `<$skill|label>` mention stripping, so strict providers do not receive a blank final user message.
### Deprecated
- None.
### Removed
- None.
### Fixed
- Fixed skill-only chat submissions producing an empty user message after backend skill mention stripping.
- Fixed the inactive/unavailable selected-skill edge case so it also cannot leave the final user message blank.
### Security
- None.
### Breaking Changes
- None.
---
### Additional Information
Closes #24929.
This replaces #24968, which was closed because the PR body did not include the required CLA template text. The code also addresses the Copilot review edge case from that PR: if the selected skill is inactive or unavailable, the backend still inserts a neutral non-empty fallback instead of allowing an empty content block through.
Validation:
- `python3 -m py_compile backend/open_webui/utils/middleware.py`
- `uvx ruff format --check backend/open_webui/utils/middleware.py`
- `git diff --check`
Note: `uvx ruff check backend/open_webui/utils/middleware.py` still reports pre-existing import, complexity, and line-length issues across this large file that are unrelated to this change.
### Screenshots or Videos
- Not applicable; backend request-shaping fix.
### Contributor License Agreement
- [x] By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24971
Author: @pragnyanramtha
Created: 5/21/2026
Status: 🔄 Open
Base:
dev← Head:pragnyan/fix-empty-skill-only-message-24929-v2📝 Commits (1)
ce9f4f2fix: avoid empty prompt for skill-only messages📊 Changes
1 file changed (+34 additions, -15 deletions)
View changed files
📝
backend/open_webui/utils/middleware.py(+34 -15)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is a small bug fix for an existing issue.
Before submitting, make sure you've checked the following:
devbranch.dev, and contains no unrelated commits.fixprefix.Changelog Entry
Description
Added
Changed
<$skill|label>mention stripping, so strict providers do not receive a blank final user message.Deprecated
Removed
Fixed
Security
Breaking Changes
Additional Information
Closes #24929.
This replaces #24968, which was closed because the PR body did not include the required CLA template text. The code also addresses the Copilot review edge case from that PR: if the selected skill is inactive or unavailable, the backend still inserts a neutral non-empty fallback instead of allowing an empty content block through.
Validation:
python3 -m py_compile backend/open_webui/utils/middleware.pyuvx ruff format --check backend/open_webui/utils/middleware.pygit diff --checkNote:
uvx ruff check backend/open_webui/utils/middleware.pystill reports pre-existing import, complexity, and line-length issues across this large file that are unrelated to this change.Screenshots or Videos
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.