[PR #24721] [CLOSED] fix: avoid unbound variables in backend/start.sh under set -u #115109

Closed
opened 2026-05-18 16:03:53 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/24721
Author: @jmleksan
Created: 5/14/2026
Status: Closed

Base: devHead: fix/assign-startsh-variables


📝 Commits (1)

  • ee67cc5 feat: add environment variable support for web loader, Ollama, and CUDA in start script

📊 Changes

1 file changed (+3 additions, -0 deletions)

View changed files

📝 backend/start.sh (+3 -0)

📄 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 to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.

Before submitting, make sure you've checked the following:

  • Linked Issue/Discussion:
  • Target branch: This PR targets dev.
  • Description: See below.
  • Changelog: Entry included in Changelog Entry (mirror into CHANGELOG.md if your process requires it).
  • Documentation: No change to user-facing env contract; variables remain optional. No docs repo update required unless maintainers want a one-line note under deployment troubleshooting.
  • Dependencies: None.
  • Testing: See Additional Information — confirm container/local start with unset WEB_LOADER_ENGINE, USE_OLLAMA_DOCKER, and USE_CUDA_DOCKER.
  • Agentic AI Code: Confirm per project policy.
  • Code review: Self-review completed.
  • Design & Architecture: No new settings; bash-only hardening for set -u.
  • Git Hygiene: Single-file, single-purpose change.
  • Title Prefix: fix:

Changelog Entry

  • 🐚 backend/start.sh with set -u. Optional environment variables (WEB_LOADER_ENGINE, USE_OLLAMA_DOCKER, USE_CUDA_DOCKER) are defaulted before case-insensitive comparisons so the container entrypoint no longer exits with unbound variable when those variables are omitted from the environment.

Description

backend/start.sh uses set -euo pipefail. Under set -u, expanding ${VAR,,} still requires VAR to be set. If optional environment variables such as WEB_LOADER_ENGINE, USE_OLLAMA_DOCKER, or USE_CUDA_DOCKER are not passed into the container (or shell), Bash exits with unbound variable before the server starts.

This PR defaults those variables before lowercasing / comparing, so missing env vars behave as “disabled” instead of crashing startup.

Changed

  • backend/start.sh: Optional flags are read safely under set -u (Playwright branch uses a defaulting assignment in the if list; Ollama/CUDA branches default the variable before ${VAR,,}).

Fixed

  • Container / script startup: Avoid start.sh: line 15: WEB_LOADER_ENGINE: unbound variable (and the same class of error for USE_OLLAMA_DOCKER / USE_CUDA_DOCKER) when those variables are unset.

Additional Information

Root cause: set -u + ${PARAMETER,,} still references PARAMETER; it is not equivalent to ${PARAMETER:-}.

Manual test suggestions

  1. Run the entrypoint (or bash backend/start.sh in a throwaway env) with no WEB_LOADER_ENGINE — expect no error and no Playwright install branch unless WEB_LOADER_ENGINE=playwright.
  2. Same with USE_OLLAMA_DOCKER and USE_CUDA_DOCKER unset — expect script to continue to uvicorn unless set to true.
  3. With WEB_LOADER_ENGINE=playwright and no PLAYWRIGHT_WS_URL, confirm Chromium install path still runs when intended.

Contributor License Agreement

Note

Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in.


🔄 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/24721 **Author:** [@jmleksan](https://github.com/jmleksan) **Created:** 5/14/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `fix/assign-startsh-variables` --- ### 📝 Commits (1) - [`ee67cc5`](https://github.com/open-webui/open-webui/commit/ee67cc5bedd0eacbba0abc14817d7ff9370a748e) feat: add environment variable support for web loader, Ollama, and CUDA in start script ### 📊 Changes **1 file changed** (+3 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/start.sh` (+3 -0) </details> ### 📄 Description <!-- ⚠️ CRITICAL CHECKS FOR CONTRIBUTORS (READ, DON'T DELETE) ⚠️ 1. Target the `dev` branch. PRs targeting `main` will be automatically closed. 2. Do NOT delete the CLA section at the bottom. It is required for the bot to accept your PR. --> # 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 to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR. **Before submitting, make sure you've checked the following:** - [ ] **Linked Issue/Discussion:** - [x] **Target branch:** This PR targets **`dev`**. - [x] **Description:** See below. - [x] **Changelog:** Entry included in **Changelog Entry** (mirror into `CHANGELOG.md` if your process requires it). - [x] **Documentation:** No change to user-facing env contract; variables remain optional. No docs repo update required unless maintainers want a one-line note under deployment troubleshooting. - [x] **Dependencies:** None. - [x] **Testing:** See **Additional Information** — confirm container/local start with **unset** `WEB_LOADER_ENGINE`, `USE_OLLAMA_DOCKER`, and `USE_CUDA_DOCKER`. - [x] **Agentic AI Code:** Confirm per project policy. - [x] **Code review:** Self-review completed. - [x] **Design & Architecture:** No new settings; bash-only hardening for `set -u`. - [x] **Git Hygiene:** Single-file, single-purpose change. - [x] **Title Prefix:** `fix:` # Changelog Entry - 🐚 **backend/start.sh with `set -u`.** Optional environment variables (`WEB_LOADER_ENGINE`, `USE_OLLAMA_DOCKER`, `USE_CUDA_DOCKER`) are defaulted before case-insensitive comparisons so the container entrypoint no longer exits with `unbound variable` when those variables are omitted from the environment. ### Description `backend/start.sh` uses `set -euo pipefail`. Under **`set -u`**, expanding `${VAR,,}` still requires `VAR` to be **set**. If optional environment variables such as **`WEB_LOADER_ENGINE`**, **`USE_OLLAMA_DOCKER`**, or **`USE_CUDA_DOCKER`** are not passed into the container (or shell), Bash exits with **`unbound variable`** before the server starts. This PR defaults those variables before lowercasing / comparing, so missing env vars behave as “disabled” instead of crashing startup. ### Changed - **`backend/start.sh`:** Optional flags are read safely under `set -u` (Playwright branch uses a defaulting assignment in the `if` list; Ollama/CUDA branches default the variable before `${VAR,,}`). ### Fixed - **Container / script startup:** Avoid start.sh: line 15: `WEB_LOADER_ENGINE: unbound variable` (and the same class of error for `USE_OLLAMA_DOCKER` / `USE_CUDA_DOCKER`) when those variables are unset. --- ### Additional Information **Root cause:** `set -u` + `${PARAMETER,,}` still references `PARAMETER`; it is not equivalent to `${PARAMETER:-}`. **Manual test suggestions** 1. Run the entrypoint (or `bash backend/start.sh` in a throwaway env) with **no** `WEB_LOADER_ENGINE` — expect no error and no Playwright install branch unless `WEB_LOADER_ENGINE=playwright`. 2. Same with `USE_OLLAMA_DOCKER` and `USE_CUDA_DOCKER` unset — expect script to continue to uvicorn unless set to `true`. 3. With `WEB_LOADER_ENGINE=playwright` and no `PLAYWRIGHT_WS_URL`, confirm Chromium install path still runs when intended. ### 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. > [!NOTE] > Deleting the CLA section will lead to immediate closure of your PR and it will not be merged in. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-18 16:03:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#115109