[GH-ISSUE #24765] bug: bing.py CLI calls search_bing() missing subscription_key and endpoint — TypeError at runtime #107394

Open
opened 2026-05-18 06:11:44 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @qizwiz on GitHub (May 15, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24765

Summary

backend/open_webui/retrieval/web/bing.py contains a CLI __main__ block that calls search_bing() with 4 positional arguments, but the function signature requires 5.

Code

# bing.py __main__ block (line ~64)
args = parser.parse_args()
results = search_bing(args.locale, args.query, args.count, args.filter)

If the search_bing signature is (subscription_key, endpoint, locale, query, count) (as the function name and Bing API structure imply), this call:

  • Maps args.localesubscription_key (wrong value)
  • Maps args.queryendpoint (wrong value)
  • Maps args.countlocale (wrong value)
  • Maps args.filterquery (wrong value)
  • countmissingTypeError at runtime

How it was found

Detected by pact (required_arg_missing mode), which checks that all required positional arguments are covered at call sites. The call has 4 positional args; the function requires 5.

Expected fix

The __main__ block should pass subscription_key and endpoint from environment variables or argparse arguments:

results = search_bing(
    subscription_key=os.environ["BING_SEARCH_V7_SUBSCRIPTION_KEY"],
    endpoint=os.environ.get("BING_SEARCH_V7_ENDPOINT", "https://api.bing.microsoft.com"),
    locale=args.locale,
    query=args.query,
    count=args.count,
)

Environment

  • File: backend/open_webui/retrieval/web/bing.py, line 66
  • Affects: the python -m open_webui.retrieval.web.bing CLI path
Originally created by @qizwiz on GitHub (May 15, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/24765 ## Summary `backend/open_webui/retrieval/web/bing.py` contains a CLI `__main__` block that calls `search_bing()` with 4 positional arguments, but the function signature requires 5. ## Code ```python # bing.py __main__ block (line ~64) args = parser.parse_args() results = search_bing(args.locale, args.query, args.count, args.filter) ``` If the `search_bing` signature is `(subscription_key, endpoint, locale, query, count)` (as the function name and Bing API structure imply), this call: - Maps `args.locale` → `subscription_key` ❌ (wrong value) - Maps `args.query` → `endpoint` ❌ (wrong value) - Maps `args.count` → `locale` ❌ (wrong value) - Maps `args.filter` → `query` ❌ (wrong value) - `count` → **missing** → `TypeError` at runtime ## How it was found Detected by [pact](https://github.com/qizwiz/pact) (`required_arg_missing` mode), which checks that all required positional arguments are covered at call sites. The call has 4 positional args; the function requires 5. ## Expected fix The `__main__` block should pass `subscription_key` and `endpoint` from environment variables or argparse arguments: ```python results = search_bing( subscription_key=os.environ["BING_SEARCH_V7_SUBSCRIPTION_KEY"], endpoint=os.environ.get("BING_SEARCH_V7_ENDPOINT", "https://api.bing.microsoft.com"), locale=args.locale, query=args.query, count=args.count, ) ``` ## Environment - File: `backend/open_webui/retrieval/web/bing.py`, line 66 - Affects: the `python -m open_webui.retrieval.web.bing` CLI path
Author
Owner

@owui-terminator[bot] commented on GitHub (May 15, 2026):

🔍 Related Issues Found

I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:

  1. 🟣 #11578 issue: Bing Web Search is 404'ing
    This is a Bing provider bug in the same open_webui web search path, with the endpoint being used incorrectly and producing a 404. It is closely related to the Bing integration wiring in backend/open_webui/retrieval/web/bing.py.
    by sfarthin · bug

  2. 🟣 #7276 Bing Search API EndPoint Format Issue
    This closed issue reports a malformed Bing request URL / endpoint format problem in the Bing search provider, which is directly related to incorrect Bing API call construction in the same module.
    by deserttroll

  3. 🟣 #7066 web search bing errors
    This issue is about Bing web search failing in the same backend Bing search codepath. Although the symptom is a different encoding error, it confirms problems in the Bing provider implementation rather than an unrelated web-search feature.
    by fq393


💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.

This comment was generated automatically. React with 👍 if helpful, 👎 if not.

<!-- gh-comment-id:4462249421 --> @owui-terminator[bot] commented on GitHub (May 15, 2026): <!-- terminator-bot:related-issues-reply --> 🔍 **Related Issues Found** I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions: 1. 🟣 [#11578](https://github.com/open-webui/open-webui/issues/11578) **issue: Bing Web Search is 404'ing** *This is a Bing provider bug in the same `open_webui` web search path, with the endpoint being used incorrectly and producing a 404. It is closely related to the Bing integration wiring in `backend/open_webui/retrieval/web/bing.py`.* *by sfarthin · `bug`* 2. 🟣 [#7276](https://github.com/open-webui/open-webui/issues/7276) **Bing Search API EndPoint Format Issue** *This closed issue reports a malformed Bing request URL / endpoint format problem in the Bing search provider, which is directly related to incorrect Bing API call construction in the same module.* *by deserttroll* 3. 🟣 [#7066](https://github.com/open-webui/open-webui/issues/7066) **web search bing errors** *This issue is about Bing web search failing in the same backend Bing search codepath. Although the symptom is a different encoding error, it confirms problems in the Bing provider implementation rather than an unrelated web-search feature.* *by fq393* --- 💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead. *This comment was generated automatically.* React with 👍 if helpful, 👎 if not.
Author
Owner

@Classic298 commented on GitHub (May 15, 2026):

https://github.com/open-webui/open-webui/pull/24768

<!-- gh-comment-id:4462328555 --> @Classic298 commented on GitHub (May 15, 2026): https://github.com/open-webui/open-webui/pull/24768
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#107394