The InputVariablesModal throws ReferenceError: idx is not defined at runtime, causing the prompt variables modal to show an infinite loading spinner. The prompt variable feature is completely broken.
Root cause: The {@const} destructuring with rest syntax ({ type, ...variableAttributes }) inside an {#each} block triggers a scoping bug in Svelte 5's legacy compatibility mode, making the loop index variable idx undefined in the compiled output.
Fix:
Renamed the loop index from idx to variableIdx to avoid the naming collision
Replaced the rest destructuring {@const} with an explicit Object.fromEntries(Object.entries(...).filter(...)) to compute variableAttributes, sidestepping the Svelte 5 compilation issue
Test plan
Create a custom prompt with one or more template variables (e.g. Hello {{name}})
Type / in the chat input and select the custom prompt
Verify the "Input Variables" modal renders input fields (no infinite spinner)
Fill in variables and confirm they populate correctly
Test with typed variables (select, checkbox, number, etc.) to ensure variableAttributes spread still works
🔄 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/22778
**Author:** [@joaquinhuigomez](https://github.com/joaquinhuigomez)
**Created:** 3/17/2026
**Status:** ❌ Closed
**Base:** `main` ← **Head:** `fix/input-variables-modal-reference-error`
---
### 📝 Commits (1)
- [`30e2182`](https://github.com/open-webui/open-webui/commit/30e21829e4f990e964d40549a41975ed3aaea545) fix: resolve ReferenceError for idx in InputVariablesModal
### 📊 Changes
**1 file changed** (+18 additions, -18 deletions)
<details>
<summary>View changed files</summary>
📝 `src/lib/components/chat/MessageInput/InputVariablesModal.svelte` (+18 -18)
</details>
### 📄 Description
## Summary
Fixes #22748
The `InputVariablesModal` throws `ReferenceError: idx is not defined` at runtime, causing the prompt variables modal to show an infinite loading spinner. The prompt variable feature is completely broken.
**Root cause:** The `{@const}` destructuring with rest syntax (`{ type, ...variableAttributes }`) inside an `{#each}` block triggers a scoping bug in Svelte 5's legacy compatibility mode, making the loop index variable `idx` undefined in the compiled output.
**Fix:**
- Renamed the loop index from `idx` to `variableIdx` to avoid the naming collision
- Replaced the rest destructuring `{@const}` with an explicit `Object.fromEntries(Object.entries(...).filter(...))` to compute `variableAttributes`, sidestepping the Svelte 5 compilation issue
## Test plan
- [ ] Create a custom prompt with one or more template variables (e.g. `Hello {{name}}`)
- [ ] Type `/` in the chat input and select the custom prompt
- [ ] Verify the "Input Variables" modal renders input fields (no infinite spinner)
- [ ] Fill in variables and confirm they populate correctly
- [ ] Test with typed variables (select, checkbox, number, etc.) to ensure `variableAttributes` spread still works
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---
<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/22778
Author: @joaquinhuigomez
Created: 3/17/2026
Status: ❌ Closed
Base:
main← Head:fix/input-variables-modal-reference-error📝 Commits (1)
30e2182fix: resolve ReferenceError for idx in InputVariablesModal📊 Changes
1 file changed (+18 additions, -18 deletions)
View changed files
📝
src/lib/components/chat/MessageInput/InputVariablesModal.svelte(+18 -18)📄 Description
Summary
Fixes #22748
The
InputVariablesModalthrowsReferenceError: idx is not definedat runtime, causing the prompt variables modal to show an infinite loading spinner. The prompt variable feature is completely broken.Root cause: The
{@const}destructuring with rest syntax ({ type, ...variableAttributes }) inside an{#each}block triggers a scoping bug in Svelte 5's legacy compatibility mode, making the loop index variableidxundefined in the compiled output.Fix:
idxtovariableIdxto avoid the naming collision{@const}with an explicitObject.fromEntries(Object.entries(...).filter(...))to computevariableAttributes, sidestepping the Svelte 5 compilation issueTest plan
Hello {{name}})/in the chat input and select the custom promptvariableAttributesspread still works🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.