[PR #20255] [MERGED] fix: retry Brave Search on HTTP 429 rate limit with 1s delay #112831

Closed
opened 2026-05-18 13:02:26 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/20255
Author: @Classic298
Created: 12/30/2025
Status: Merged
Merged: 12/30/2025
Merged by: @tjbck

Base: devHead: brave


📝 Commits (2)

📊 Changes

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

View changed files

📝 backend/open_webui/retrieval/web/brave.py (+9 -0)

📄 Description

Summary

Adds automatic retry logic to the Brave Search integration when a 429 (Too Many Requests) response is received. This addresses the issue where Brave's free tier enforces a strict 1 request per second limit that can be hit even when concurrent requests is set to 1.

Problem

Setting WEB_SEARCH_CONCURRENT_REQUESTS to 1 prevents parallel requests, but does not add any delay between sequential requests. If your internet connection is fast enough, back-to-back requests can still exceed Brave's 1 request/second limit, resulting in 429 errors.

Solution

When the Brave API returns HTTP 429, the code now:

  1. Logs a warning
  2. Waits 1 second
  3. Retries the request once
  4. Proceeds with normal error handling if the retry also fails

This is a minimal, targeted fix that only affects Brave Search and respects the documented API rate limit without requiring additional configuration.

Fixes #15134

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/20255 **Author:** [@Classic298](https://github.com/Classic298) **Created:** 12/30/2025 **Status:** ✅ Merged **Merged:** 12/30/2025 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `brave` --- ### 📝 Commits (2) - [`d9dc613`](https://github.com/open-webui/open-webui/commit/d9dc613b0bf5ef0350df8761b7fadeb494a876cf) Update brave.py - [`a48f560`](https://github.com/open-webui/open-webui/commit/a48f56086b3681fe690dd23eb05a027c394f36a8) Update brave.py ### 📊 Changes **1 file changed** (+9 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/retrieval/web/brave.py` (+9 -0) </details> ### 📄 Description ### Summary Adds automatic retry logic to the Brave Search integration when a 429 (Too Many Requests) response is received. This addresses the issue where Brave's free tier enforces a strict 1 request per second limit that can be hit even when concurrent requests is set to 1. ### Problem Setting WEB_SEARCH_CONCURRENT_REQUESTS to 1 prevents parallel requests, but does not add any delay between sequential requests. If your internet connection is fast enough, back-to-back requests can still exceed Brave's 1 request/second limit, resulting in 429 errors. ### Solution When the Brave API returns HTTP 429, the code now: 1. Logs a warning 2. Waits 1 second 3. Retries the request once 4. Proceeds with normal error handling if the retry also fails This is a minimal, targeted fix that only affects Brave Search and respects the documented API rate limit without requiring additional configuration. ### Related Issues Fixes #15134 ### Contributor License Agreement 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 13:02:26 -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#112831