Testing: Manually tested (modal no longer crashes, all input types work)
Code review: Self-reviewed
Git Hygiene: Single focused fix
Description
Fixes a runtime crash in InputVariablesModal.svelte when rendering input variables.
The modal could throw:
ReferenceError: variable is not defined
Root cause was unsafe iteration using Object.keys + indexing (variables[key]), which resulted in invalid compiled code and undefined access.
Replaced iteration with Object.entries and removed unsafe access pattern.
Changelog Entry
Description
Fix crash in Input Variables modal caused by unsafe variable iteration
Added
—
Changed
Switched from Object.keys + indexing to Object.entries iteration in InputVariablesModal.svelte
Simplified variable access to avoid undefined references
Deprecated
—
Removed
—
Fixed
Fixed ReferenceError: variable is not defined when opening Input Variables modal
Fixed crash when variables object is malformed or partially undefined
Security
—
Breaking Changes
—
Additional Information
Fix is minimal and scoped only to iteration logic
No changes to API or variable format
Prevents generation of invalid compiled Svelte code
Screenshots or Videos
Before: modal crashes on open
After: modal renders correctly and accepts input
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.
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/23864
**Author:** [@moreveal](https://github.com/moreveal)
**Created:** 4/18/2026
**Status:** ❌ Closed
**Base:** `dev` ← **Head:** `fix/input-variables-crash`
---
### 📝 Commits (1)
- [`11731cc`](https://github.com/open-webui/open-webui/commit/11731cc43d94bb63a885cb6a7b5cd37e18da31c6) fix: prevent InputVariablesModal crash (variable undefined)
### 📊 Changes
**1 file changed** (+76 additions, -73 deletions)
<details>
<summary>View changed files</summary>
📝 `src/lib/components/chat/MessageInput/InputVariablesModal.svelte` (+76 -73)
</details>
### 📄 Description
# Pull Request Checklist
* [x] **Target branch:** `dev`
* [x] **Description:** Added below
* [x] **Changelog:** Added
* [x] **Testing:** Manually tested (modal no longer crashes, all input types work)
* [x] **Code review:** Self-reviewed
* [x] **Git Hygiene:** Single focused fix
---
## Description
Fixes a runtime crash in `InputVariablesModal.svelte` when rendering input variables.
The modal could throw:
```
ReferenceError: variable is not defined
```
Root cause was unsafe iteration using `Object.keys` + indexing (`variables[key]`), which resulted in invalid compiled code and undefined access.
Replaced iteration with `Object.entries` and removed unsafe access pattern.
---
# Changelog Entry
### Description
* Fix crash in Input Variables modal caused by unsafe variable iteration
### Added
* —
### Changed
* Switched from `Object.keys` + indexing to `Object.entries` iteration in `InputVariablesModal.svelte`
* Simplified variable access to avoid undefined references
### Deprecated
* —
### Removed
* —
### Fixed
* Fixed `ReferenceError: variable is not defined` when opening Input Variables modal
* Fixed crash when variables object is malformed or partially undefined
### Security
* —
### Breaking Changes
* —
---
### Additional Information
* Fix is minimal and scoped only to iteration logic
* No changes to API or variable format
* Prevents generation of invalid compiled Svelte code
---
### Screenshots or Videos
* Before: modal crashes on open
* After: modal renders correctly and accepts input
---
### 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>
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/23864
Author: @moreveal
Created: 4/18/2026
Status: ❌ Closed
Base:
dev← Head:fix/input-variables-crash📝 Commits (1)
11731ccfix: prevent InputVariablesModal crash (variable undefined)📊 Changes
1 file changed (+76 additions, -73 deletions)
View changed files
📝
src/lib/components/chat/MessageInput/InputVariablesModal.svelte(+76 -73)📄 Description
Pull Request Checklist
devDescription
Fixes a runtime crash in
InputVariablesModal.sveltewhen rendering input variables.The modal could throw:
Root cause was unsafe iteration using
Object.keys+ indexing (variables[key]), which resulted in invalid compiled code and undefined access.Replaced iteration with
Object.entriesand removed unsafe access pattern.Changelog Entry
Description
Added
Changed
Object.keys+ indexing toObject.entriesiteration inInputVariablesModal.svelteDeprecated
Removed
Fixed
ReferenceError: variable is not definedwhen opening Input Variables modalSecurity
Breaking Changes
Additional Information
Screenshots or Videos
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.