[PR #22618] [CLOSED] fix(tool-server): add AbortController timeout to openapi.json fetch (fixes #22543) #26783

Closed
opened 2026-04-20 06:42:33 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22618
Author: @gambletan
Created: 3/12/2026
Status: Closed

Base: mainHead: fix/openapi-fetch-timeout


📝 Commits (1)

  • 4a2501c fix(tool-server): add AbortController timeout to openapi.json fetch

📊 Changes

1 file changed (+17 additions, -5 deletions)

View changed files

📝 src/lib/apis/index.ts (+17 -5)

📄 Description

Summary

Fixes #22543 — infinite UI hang when an external OpenAPI tool server is unreachable.

  • The fetch() call in getToolServerData (src/lib/apis/index.ts) had no timeout or abort signal, causing the browser to keep the request Pending forever and blocking page load when a configured tool server is unreachable.
  • Added an AbortController with a 10-second default timeout (timeout parameter, configurable). The signal is passed to fetch().
  • On AbortError, a descriptive "Connection timed out after 10s" error is thrown instead of hanging.
  • Existing error handling in getToolServersData propagates this as { error, url }, which setToolServers (in src/routes/(app)/+layout.svelte) already converts into a non-blocking toast.error() warning — so page load continues and the user sees a clear message.

Behaviour change

Before After
Unreachable tool server causes page to spin indefinitely Fetch aborts after 10 s; toast shows "Failed to connect to <URL> OpenAPI tool server"; rest of the page loads normally

Test plan

  • Add an OpenAPI tool server pointing to an unreachable URL (e.g. http://localhost:2022)
  • Enable the connection and save
  • Reload Open WebUI — page should load within ~10 s and show a toast error for the unreachable server
  • Verify that reachable tool servers still work correctly
  • Confirm the timeout can be overridden by callers via the optional timeout parameter

🤖 Generated with Claude Code


🔄 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/22618 **Author:** [@gambletan](https://github.com/gambletan) **Created:** 3/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/openapi-fetch-timeout` --- ### 📝 Commits (1) - [`4a2501c`](https://github.com/open-webui/open-webui/commit/4a2501c2e1a1308a05fc070edce80731c5306d48) fix(tool-server): add AbortController timeout to openapi.json fetch ### 📊 Changes **1 file changed** (+17 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/apis/index.ts` (+17 -5) </details> ### 📄 Description ## Summary Fixes #22543 — infinite UI hang when an external OpenAPI tool server is unreachable. - The `fetch()` call in `getToolServerData` (`src/lib/apis/index.ts`) had no timeout or abort signal, causing the browser to keep the request `Pending` forever and blocking page load when a configured tool server is unreachable. - Added an `AbortController` with a **10-second default timeout** (`timeout` parameter, configurable). The `signal` is passed to `fetch()`. - On `AbortError`, a descriptive `"Connection timed out after 10s"` error is thrown instead of hanging. - Existing error handling in `getToolServersData` propagates this as `{ error, url }`, which `setToolServers` (in `src/routes/(app)/+layout.svelte`) already converts into a non-blocking `toast.error()` warning — so page load continues and the user sees a clear message. ## Behaviour change | Before | After | |---|---| | Unreachable tool server causes page to spin indefinitely | Fetch aborts after 10 s; toast shows "Failed to connect to \<URL\> OpenAPI tool server"; rest of the page loads normally | ## Test plan - [ ] Add an OpenAPI tool server pointing to an unreachable URL (e.g. `http://localhost:2022`) - [ ] Enable the connection and save - [ ] Reload Open WebUI — page should load within ~10 s and show a toast error for the unreachable server - [ ] Verify that reachable tool servers still work correctly - [ ] Confirm the timeout can be overridden by callers via the optional `timeout` parameter 🤖 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>
GiteaMirror added the pull-request label 2026-04-20 06:42:33 -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#26783