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):
- 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. - Workflows: write as well, to change files under
.github/workflows. GitHub lists it as an additional permission for writing or deleting a file (PUTorDELETE /repos/{owner}/{repo}/contents/{path}), creating or moving a branch (POST /repos/{owner}/{repo}/git/refsandPATCHon/git/refs/{ref}), and creating or editing a release, which is why a header can readcontents=write; contents=write,workflows=write. A classic token needs theworkflowscope for the same files (GitHub's permissions for fine-grained tokens and create or update file contents). - 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.
- Deployments: read, for the deployments and their statuses (
GET /repos/{owner}/{repo}/deploymentsandGET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses); write to create a deployment or set its status (POSTon the same addresses) (GitHub's list, Deployments). - Code scanning alerts: read, for the alerts and analyses (
GET /repos/{owner}/{repo}/code-scanning/alertsandGET /repos/{owner}/{repo}/code-scanning/analyses); write to update an alert (PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}) or to upload an analysis as SARIF data (POST /repos/{owner}/{repo}/code-scanning/sarifs) (the same list, Code scanning alerts). - Administration: read, to list the teams that have access to the repository (
GET /repos/{owner}/{repo}/teams), for example to offer teams as reviewers. An organization's own list of teams (GET /orgs/{org}/teams) is under the organization permission Members (read), and organization permissions can only be used when the token's resource owner is that organization (GitHub's permissions for fine-grained tokens). - Metadata: read, for the repository itself (
GET /repos/{owner}/{repo}), its collaborators and one user's permission (GET /repos/{owner}/{repo}/collaborators/{username}/permission), the rules that apply to a branch (GET /repos/{owner}/{repo}/rules/branches/{branch}) and the repository's rulesets (GET /repos/{owner}/{repo}/rulesets) (the same list, Metadata). - Actions: read, for the workflow runs of GitHub Actions (
GET /repos/{owner}/{repo}/actions/runs). The list has no permission for check runs. - Check runs: none for a fine-grained token. The Checks API (check runs and check suites, such as
GET /repos/{owner}/{repo}/commits/{ref}/check-runs) does not work with fine-grained personal access tokens, and calling it is one of the gaps GitHub lists for them (fine-grained personal access tokens limitations). A classic token reads them, with the repo scope on a private repository (list check runs for a Git reference); see also checks not shown. - Levels: the levels are read, write and admin. Write always includes read, and admin always includes write, so a token with Pull requests write already meets
pull_requests=read. Not every permission takes every level: some are read-only, some write-only, and only a few take admin (GitHub's managing your personal access tokens).
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.
- What a fine-grained token cannot do yet: besides the public repositories and outside collaborators above, GitHub lists using one to access several organizations at once (one token per resource owner), Packages, the Checks API and Projects owned by a user account (limitations). A few REST endpoints are only available with a classic token; GitHub keeps the list of endpoints available for fine-grained personal access tokens.
- A maximum lifetime: organization owners can set the longest lifetime a token may have. A member's token with a lifetime over it is blocked from the organization, without being revoked, and its owner finds out when the token's API calls for the organization are rejected. For fine-grained tokens the default is 366 days; classic tokens have no expiration requirement unless the organization sets one (enforcing a maximum lifetime policy). Make a new token with a shorter expiration.
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"
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 · 日本語