Skip to content

gh issue create fails with fine-grained PAT that has Issues:Write but not Contents:Read #12798

@adstastic

Description

@adstastic

gh issue create fails with Resource not accessible by personal access token (repository.defaultBranchRef) when using a fine-grained PAT that has:

  • Metadata: Read
  • Issues: Read and write

The underlying GraphQL query fetches defaultBranchRef, which requires Contents: Read. Creating an issue shouldn't need repository content access.

The REST API equivalent (POST /repos/{owner}/{repo}/issues) works fine with the same token.

Workaround: Grant Contents: Read on the token.

Expected: gh issue create should work with only Issues: Read and write + Metadata: Read permissions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-issuerelating to the gh issue commandpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions