Describe the bug
gh search repos says it supports GitHub search syntax, but when a full search query with multiple qualifiers is passed as one shell argument, gh rewrites it as a single quoted value for the first qualifier.
For example, this query:
gh search repos 'topic:artificial-intelligence stars:>5000 pushed:>2026-06-01 archived:false' --sort updated
is sent to the API as:
topic:"artificial-intelligence stars:>5000 pushed:>2026-06-01 archived:false"
As a result, qualifiers such as stars:>5000, pushed:>2026-06-01, and archived:false are no longer applied as filters.
If this behavior is confirmed as a bug and external contribution would be welcome, I would be happy to send a focused PR with tests.
Affected version
gh version 2.95.0 (2026-06-17)
https://github.com/cli/cli/releases/tag/v2.95.0
Steps to reproduce the behavior
- Run:
GH_DEBUG=api gh search repos 'topic:artificial-intelligence stars:>5000 pushed:>2026-06-01 archived:false' --sort updated --limit 1 --json fullName,stargazersCount
- Observe that the request URL contains the whole query as the quoted
topic: value:
q=topic%3A%22artificial-intelligence+stars%3A%3E5000+pushed%3A%3E2026-06-01+archived%3Afalse%22
- Observe that a repository below 5,000 stars can be returned:
[{"fullName":"EalZz/IT-AI-NEWS","stargazersCount":2}]
Expected vs actual behavior
Expected:
The query should preserve the GitHub search syntax:
topic:artificial-intelligence stars:>5000 pushed:>2026-06-01 archived:false
Actual:
The query is rewritten as:
topic:"artificial-intelligence stars:>5000 pushed:>2026-06-01 archived:false"
This makes the later qualifiers part of the topic: value instead of independent filters.
Passing the qualifiers as separate argv entries works:
gh search repos topic:artificial-intelligence 'stars:>5000' 'pushed:>2026-06-01' archived:false --sort updated --limit 1 --json fullName,stargazersCount
Using flags also works:
gh search repos --topic artificial-intelligence --stars '>5000' --updated '>2026-06-01' --archived=false --sort updated --limit 1 --json fullName,stargazersCount
Logs
* Request to https://api.github.com/search/repositories?page=1&per_page=1&q=topic%3A%22artificial-intelligence+stars%3A%3E5000+pushed%3A%3E2026-06-01+archived%3Afalse%22&sort=updated
[{"fullName":"EalZz/IT-AI-NEWS","stargazersCount":2}]
Describe the bug
gh search repossays it supports GitHub search syntax, but when a full search query with multiple qualifiers is passed as one shell argument,ghrewrites it as a single quoted value for the first qualifier.For example, this query:
gh search repos 'topic:artificial-intelligence stars:>5000 pushed:>2026-06-01 archived:false' --sort updatedis sent to the API as:
As a result, qualifiers such as
stars:>5000,pushed:>2026-06-01, andarchived:falseare no longer applied as filters.If this behavior is confirmed as a bug and external contribution would be welcome, I would be happy to send a focused PR with tests.
Affected version
Steps to reproduce the behavior
GH_DEBUG=api gh search repos 'topic:artificial-intelligence stars:>5000 pushed:>2026-06-01 archived:false' --sort updated --limit 1 --json fullName,stargazersCounttopic:value:[{"fullName":"EalZz/IT-AI-NEWS","stargazersCount":2}]Expected vs actual behavior
Expected:
The query should preserve the GitHub search syntax:
Actual:
The query is rewritten as:
This makes the later qualifiers part of the
topic:value instead of independent filters.Passing the qualifiers as separate argv entries works:
Using flags also works:
Logs