Repository navigation
Open
Labels
bugSomething isn't workinggh-apirelating to the gh api commandneeds-investigationCLI team needs to investigatepriority-3Affects a small number of users or is largely cosmetic
Description
Describe the bug
When using the gh CLI, when hitting the /repos/$ORG/$REPO/dependabot/alerts endpoint, a 403 error is accompanied by the message "gh: This API operation needs the "delete_repo" scope."
Affected version
gh version 2.103.3 (2026-10-26)
https://github.com/cli/cli/releases/tag/v2.103.3
Steps to reproduce the behavior
- Create a repo
- Do not enable dependabot alerts for it and/or have a token that doesn't no have permissions to read the alerts
- List them via the CLI
Expected vs actual behavior
Expected: The error message says what scopes are actually needed.
Actual: The error messages tells me I need to be able to delete my repo in order to read security alerts.
Logs
GH_DEBUG=api gh api -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2026-03-10' --paginate --jq '.[]' '/repos/$ORG/$REPO/dependabot/alerts?state=open&per_page=100'
* Request to https://api.github.com/repos/$ORG/$REPO/dependabot/alerts?state=open&per_page=100
> GET /repos/$ORG/$REPO/dependabot/alerts?state=open&per_page=100 HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github+json
> Content-Type: application/json; charset=utf-8
> User-Agent: GitHub CLI 2.103.3
> X-Github-Api-Version: 2026-03-10
< HTTP/2.0 403 Forbidden
< Content-Type: application/json; charset=utf-8
< Server: github.com
< X-Accepted-Oauth-Scopes: admin:repo_hook, delete_repo, read:repo_hook, repo, repo:invite, repo:status, repo_deployment, security_events, write:repo_hook
< X-Github-Api-Version-Selected: 2026-03-10
< X-Github-Media-Type: github.v3; format=json
< X-Oauth-Scopes: admin:public_key, admin:repo_hook, gist, read:org, repo
{
"message": "Dependabot alerts are disabled for this repository.",
"documentation_url": "https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-a-repository",
"status": "403"
}
* Request took 523.382517ms
{
"message": "Dependabot alerts are disabled for this repository.",
"documentation_url": "https://docs.github.com/rest/dependabot/alerts#list-dependabot-alerts-for-a-repository",
"status": "403"
}
gh: Dependabot alerts are disabled for this repository. (HTTP 403)
gh: This API operation needs the "delete_repo" scope. To request it, run: gh auth refresh -h github.com -s delete_repo
Reacted by Ullrich @ Work
Metadata
Metadata
Assignees
Labels
bugSomething isn't workinggh-apirelating to the gh api commandneeds-investigationCLI team needs to investigatepriority-3Affects a small number of users or is largely cosmetic
Activity
cli-triage commentedon Nov 6, 2026
Reproducible on 2.103.3.
Using test data with the reported accepted and held scope headers:
Exit status:
1.The latest release build and source revision
c235ae3produced the same misleading hint. The actual 403 reason remains visible, but the suggested remediation is incorrect.Supporting reports
Duplicate analysis
Label reasoning
Reproduction log
Investigation notes
Generated by issue triage.
wUEZRs commentedon Nov 17, 2026
Another repro of the misleading scope hint, on the enterprise billing budgets endpoint:
With
gh2.103.3, the actual validation error is followed by:But GitHub's OAuth scope documentation says
admin:enterpriseincludesmanage_billing:enterprise. In this case the response is a budget validation error, not a missing authorization scope, so the suggested reauthorization is unnecessary. It looks like the same issue: the CLI comparesX-Accepted-OAuth-Scopeswith the token scopes but doesn't account for this parent-scope implication.