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".
Permissions that pull request tools need
From GitHub's permissions required for fine-grained personal access tokens (repository permissions):
- Pull requests: read to list and read pull requests; write to review (approve or request changes), comment on lines, create a pull request and update its branch.
- Contents: write to merge. The merge endpoint (
PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge) is listed under Contents, not Pull requests, so a token with Pull requests write can approve but not merge. - Issues or Pull requests: write to post in a pull request's conversation (
POST /repos/{owner}/{repo}/issues/{issue_number}/commentsaccepts either). - Commit statuses: read, for the statuses that CI services set on the commits.
- Actions: read, for the workflow runs of GitHub Actions (
GET /repos/{owner}/{repo}/actions/runs). The list has no permission for check runs.
When the permissions look right
Then check what the token can reach. From GitHub's Managing your personal access tokens:
- Resource owner: the token can only access resources owned by the owner chosen when it was made. A token made for your account does not reach an organization's private repositories, and cannot change its public ones.
- Repository access: with Only select repositories, the token reaches only those. Every token can read all public repositories, so it can read a public repository outside its selection, but not change it.
- Someone else's public repository: only a classic token has write access to public repositories that are not owned by you or by an organization you are a member of.
- Outside collaborators can only use a classic token for the organization repositories they collaborate on.
- Pending approval: if the organization requires approval for fine-grained tokens, the token stays pending until an organization administrator reviews it, and until then reads only public resources.
- Blocked: an organization that blocks fine-grained tokens does not appear as a resource owner. A classic token with the repo scope is the remaining choice there, if the organization allows it: an organization can refuse classic tokens too, with a 403.
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
- Your profile picture, Settings, Developer settings, Personal access tokens, Fine-grained tokens, Generate new token.
- 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). - Generate token, copy it, and if the organization requires approval, wait for it.
- Put the new token where the old one was, and delete the old one on the same page.
In IntelliJ IDEA: "User authorization failed"
How the GitHub support built into IntelliJ IDEA takes this refusal, in its source (checked October 30, 2026; IntelliJ IDEA: GithubApiRequestExecutor.kt, GithubApiRequest.kt, GHAPIExceptionUtil.kt, GHSelectorErrorStatusPresenter.kt):
- A REST 403 whose message does not say "API rate limit exceeded" is taken as a refused login, this one included. When the Pull Requests tool window connects, it reads "Could not connect to repository … with account …" and "User authorization failed", with Log in again…; GitHub's message is not shown. The request code does not read
X-Accepted-GitHub-Permissionseither; thecurlabove shows both. Logging in again does not change what the token may do: it needs the permissions. - GraphQL answers that carry errors instead of the data asked for: an error of the type
INSUFFICIENT_SCOPESis also taken as a refused login, and 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).
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 · 日本語