REST Code Search API returns zero results for existing terms in some repositories #206247
Replies: 4 comments 1 reply
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
|
Code search seems to be recently broken. |
|
The code search in |
|
Ketho’s observation that For automation, I’d use a fail-closed fallback:
from base64 import b64decode
import requests
r = requests.get(
"https://api.github.com/repos/vistar941/CustomNavigationTitle/contents/Package.swift",
params={"ref": "main"},
headers={"Accept": "application/vnd.github+json"},
timeout=20,
)
r.raise_for_status()
text = b64decode(r.json()["content"]).decode("utf-8")
found = "CustomNavigationTitle" in text
Given that the web UI was affected too, paired REST/UI timestamps and request IDs from a failing window would be particularly useful to GitHub. Since the report now appears intermittently recovered, rerunning the exact reproduction periodically should also show whether the index has caught up or the problem is still shard-specific. |
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Bug
💬 Feature/Topic Area
API
Body
Since approximately August 29, 2026, the REST Code Search API has been returning zero results for terms that definitely exist in some repositories.
Reproduction
Repository:
https://github.com/vistar941/CustomNavigationTitle
The term
CustomNavigationTitleexists inPackage.swift,README.md, and other files:https://github.com/vistar941/CustomNavigationTitle/blob/main/Package.swift
Request:
gh api --method GET search/code \ -f q='CustomNavigationTitle repo:vistar941/CustomNavigationTitle' \ -f per_page=3Actual response:
{ "total_count": 0, "incomplete_results": false, "items": [] }The request returned HTTP 200. It was not rate-limited:
Expected result: at least
Package.swiftandREADME.mdshould be returned.Control query
The API is not failing for every repository. The following request, made seconds later with the same authentication and client, returned seven results:
gh api --method GET search/code \ -f q='"package main" repo:cli/cli' \ -f per_page=3Response summary:
{ "total_count": 7, "incomplete_results": false }Its request ID was:
A single-character query such as
a repo:vistar941/CustomNavigationTitlealso returns results, while longer terms that definitely exist return zero results.I have observed the same behavior with multiple other public and private repositories. This was working normally until approximately yesterday.
The GitHub web Code Search interface appears to be affected as well. I added the web-search reproduction details to this related report:
https://github.com/orgs/community/discussions/206192#discussioncomment-18204982
Could GitHub please investigate whether some REST Code Search indexes or shards have become inconsistent?
All reactions