Lesstep
GitHub · fine-grained personal access tokens · Checked October 24, 2026

GitHub: "Resource not accessible by personal access token"

GitHub's own explanation: the token has insufficient permissions. A fine-grained personal access token was created without a permission this call needs, or in a way that does not reach this repository. GitHub refuses with HTTP 403, and its REST answers carry a header that names the permissions the call accepts. Give the token those permissions, then try again.

The whole answer

A real one, for posting a pull request review with a token that could read (from a public report); the body has this shape (another report):

HTTP 403
x-accepted-github-permissions: pull_requests=write

{"message": "Resource not accessible by personal access token",
 "documentation_url": "https://docs.github.com/rest/...",
 "status": "403"}

From GitHub's Troubleshooting the REST API: X-Accepted-GitHub-Permissions is a comma-separated list of the permissions the endpoint requires; when there is a choice, the sets are separated by a semicolon. pull_requests=write,contents=read means both; contents=write; contents=write,workflows=write (from a public report) means either set. Many tools show only the message. To see the header, call the address that failed with curl:

curl -i -H "Authorization: Bearer your-token" "https://api.github.com/the/address/that/failed"

GitHub gives the same explanation for "Resource not accessible by integration". When a GitHub Actions workflow gets it with the job's GITHUB_TOKEN, see GitHub Actions: "Resource not accessible by integration".

To know which permissions your token needs: Pull Request Inbox for GitHub, a plugin for JetBrains IDEs, says which permissions the token needs when GitHub answers with this message, and offers its settings, which link to GitHub's new-token page.

Permissions that pull request tools need

From GitHub's permissions required for fine-grained personal access tokens (repository permissions):

When the permissions look right

Then check what the token can reach. From GitHub's Managing your personal access tokens:

A private repository the token cannot reach answers 404 Not Found instead: GitHub does not confirm that private repositories exist (404 Not Found for an existing resource).

If the message is "Resource protected by organization SAML enforcement" instead, the organization uses single sign-on and the token needs authorizing for it: see authorize the token for single sign-on. If GitHub answers 401 "Bad credentials", the token itself is no longer accepted: see why GitHub stopped accepting it.

Create a token with the permissions

  1. Your profile picture, Settings, Developer settings, Personal access tokens, Fine-grained tokens, Generate new token.
  2. A name and an expiration, the Resource owner that owns the repository, Repository access that includes it, and under Permissions every permission from the header. GitHub can open the form with them filled in, for example https://github.com/settings/personal-access-tokens/new?name=IDE&pull_requests=write&contents=write&statuses=read (pre-filling a token).
  3. Generate token, copy it, and if the organization requires approval, wait for it.
  4. Put the new token where the old one was, and delete the old one on the same page.

In IntelliJ IDEA: "User authorization failed"

Checked in the IntelliJ IDEA source on October 30, 2026: GithubApiRequestExecutor.kt, GithubApiRequest.kt, GHAPIExceptionUtil.kt, GHSelectorErrorStatusPresenter.kt.

When the Pull Requests tool window connects and GitHub refuses with this 403, the IDE reads:

Could not connect to repository … with account …
User authorization failed
Log in again…

A REST 403 whose message does not say "API rate limit exceeded" is taken as a refused login, this one included, and GitHub's message is not shown. The request code does not read X-Accepted-GitHub-Permissions either; the curl above shows both. Logging in again does not change what the token may do: it needs the permissions.

In GraphQL, when an answer carries errors instead of the data asked for, an error of the type INSUFFICIENT_SCOPES is also taken as a refused login. Any other error is shown with GitHub's message.

When GitHub's message begins with "Could not resolve to a Repository", IntelliJ IDEA adds "Repository not found or access denied. This is likely due to OAuth App access restrictions within your organization." and a link to a JetBrains support article. The note speaks only of an organization's OAuth app access restrictions; if you logged in with a token, its resource owner and repository access above are worth checking too.

GitHub pull requests in IntelliJ IDEA

Pull Request Inbox for GitHub, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, reads with a fine-grained token's Pull requests, Contents and Commit statuses read (and GitHub Actions runs with Actions read), and approves, comments and merges with Pull requests and Contents write (or a classic token with repo). When GitHub answers with this message, the plugin shows it, says which permissions the token needs, and offers to open its settings, which link to GitHub's new-token page. The review inbox, diffs and conversations are free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).

Get it on JetBrains Marketplace

GitHub is a trademark of GitHub, Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitHub, Inc. or JetBrains.

More: "API rate limit exceeded" · GitHub merge refused (405, 409) · GitHub review refused (422) · GitHub search 422 "Validation Failed" · GitHub diff 406 "too_large", 3,000 files · GitHub line comment 422 "must be part of the diff" · GitHub branch update refused (422) · GitHub pull request not created (422, 403) · GitHub auto-merge refused · GitHub draft, ready for review or close refused · GitHub conversation not resolved · GitHub checks not shown (check runs 403) · GitHub file contents not read · GitHub compare refused (404, 422) · GitHub comment or reply refused (403 locked, archived) · GitHub merge method not allowed (405) · GitHub branch not found (404, 301) · GitHub Enterprise Server not reached · GitHub review request not shown · GitHub pull request list incomplete · GitHub 404 Not Found, renamed repositories (301, 307) · GitHub line comment outdated or not on the diff · GitHub pull requests not updating, notifications late · GitHub suggested change cannot be applied · GitHub required check stuck at "Expected" · GitHub code owner review required · GitHub merge blocked by unresolved conversations · GitHub merge blocked by unsigned commits · GitHub branch that merges through a merge queue · GitHub merge waiting for an approval of the most recent push · GitHub merge waiting for code scanning results · GitHub merge waiting for code quality results · GitHub merge blocked by a code coverage threshold · GitHub merge blocked by license compliance results · GitHub branch locked or its updates restricted · GitHub branch not deleted after merging · GitHub merge waiting for a team's approval (Required reviewers) · GitHub merge blocked by secret scanning alerts · GitHub stacked pull request not merging · GitHub push blocked by push rules · GitHub merge blocked by commit metadata rules · GitHub force push blocked · GitHub issue not closed by a merged pull request · GitHub pull request not checked out locally · GitHub pull request has merge conflicts · GitHub changes requested and dismissing a review · GitHub co-author not credited for a commit · GitHub dependency review check failed · GitHub Dependabot not rebasing its pull request · GitHub fork not syncing with upstream · GitHub pull request base branch not changing · GitHub pull request not reverting · GitHub pull request template not showing · GitHub pull request labels or assignees not added · GitHub pull request not closing or reopening · GitHub push blocked by push protection · GitHub pull request comment hidden · GitHub pull request blocked until deployments succeed · GitHub team review request replaced by members · GitHub pull request file no longer marked Viewed · GitHub pull request marked merged without being merged · GitHub Copilot review does not count as an approval · GitHub checks not running on a pull request a workflow created · GitHub Update branch button not shown on a pull request · GitHub checks failing on a Dependabot pull request · GitHub checks failing on a pull request from a fork · GitHub checks skipped by [skip ci] in a commit message · GitHub checks gone after the retention period · GitHub code review limits in a public repository · GitHub pull requests turned off or limited in a repository · GitHub checks run on every pull request in a stack · GitHub pull request showing commits already squash merged · GitHub pull request not showing a file diff · GitHub push to a pull request branch from a fork refused · GitHub check cancelled on a pull request · GitHub Rebase and merge not available · GitHub merge commit message not what you expected · GitHub pull request shows every line changed · GitHub API request timed out · GitHub pull request image or document diff not shown · GitHub review request refused (422) · GitHub pull request from Copilot: checks not running, approval not counted · GitHub push refused: GH006 and GH013 on a protected branch · GitHub "At least 1 approving review is required", approvals that do not count · GitHub pull request plugins for IntelliJ IDEA, compared · 日本語