Problem
Encountered some new errors on the Github PAT integration having issues indexing pull requests. The errors were pinpointing to insufficient roles on the personal access token.
Error message:
Error retrieving merge/pull requests events for the repository 'John-Smith/Staging' (repoId=3594): External service error
External service error
com.bigbrassband.jira.git.exceptions.external.WrappedGithubAPIException: External service error
at com.bigbrassband.jira.git.services.integration.github.GitHubApi.getMergeRequestsTimeline(GitHubApi.java:301)
at com.bigbrassband.jira.git.services.integration.github.GitHubApiService$GitHubRepoApi.getMergeRequestsTimeline(GitHubApiService.java:136)
at com.bigbrassband.jira.git.services.indexer.pullrequests.MergeRequestEventRetrieverImpl$EventsLoaderAfterTimestamp.load(MergeRequestEventRetrieverImpl.java:285)
at com.bigbrassband.jira.git.services.indexer.pullrequests.MergeRequestEventRetrieverImpl.updateMergeRequestsEvents(MergeRequestEventRetrieverImpl.java:107)
at com.bigbrassband.jira.git.services.indexer.revisions.GitPluginIndexManagerImpl.innerUpdateIndexMainNode(GitPluginIndexManagerImpl.java:361)
at com.bigbrassband.jira.git.services.indexer.revisions.GitPluginIndexManagerImpl.updateIndexMainNode(GitPluginIndexManagerImpl.java:309)
at com.bigbrassband.jira.git.services.async.ReindexQueueReindexTask.doRepositoryUpdate(ReindexQueueReindexTask.java:380)
at com.bigbrassband.jira.git.services.async.ReindexQueueReindexTask.visit(ReindexQueueReindexTask.java:149)
at com.bigbrassband.jira.git.services.gitmanager.SubGitManager.accept(SubGitManager.java:124)
at com.bigbrassband.jira.git.services.async.ReindexQueueReindexTask.doRun(ReindexQueueReindexTask.java:133)
at com.bigbrassband.jira.git.services.async.ReindexQueueTask.run(ReindexQueueTask.java:37)
at com.bigbrassband.jira.git.services.async.ReindexQueueManagerImpl$QueueTask.doRun(ReindexQueueManagerImpl.java:227)
at com.bigbrassband.jira.git.utils.concurrent.cancel.CancellableTask.run1(CancellableTask.java:38)
at com.bigbrassband.jira.git.utils.concurrent.cancel.CancellableTask.call(CancellableTask.java:25)
at com.bigbrassband.jira.git.utils.concurrent.cancel.CancellableTask.call(CancellableTask.java:8)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.bigbrassband.jira.git.utils.concurrent.JiraAdaptedThreadFactory.lambda$wrap$1(JiraAdaptedThreadFactory.java:42)
at com.bigbrassband.jira.git.utils.concurrent.cancel.CancellableJiraAdaptedThreadFactory.lambda$wrap$0(CancellableJiraAdaptedThreadFactory.java:24)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: com.bigbrassband.jira.git.exceptions.internal.ExternalServiceException: {"type":"INSUFFICIENT_SCOPES","locations":[{"line":1,"column":1613}],"message":"Your token has not been granted the required scopes to execute this query. The 'id' field requires one of the following scopes: ['read:org'], but your token has only been granted the: ['repo'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."}
{"type":"INSUFFICIENT_SCOPES","locations":[{"line":1,"column":1616}],"message":"Your token has not been granted the required scopes to execute this query. The 'login' field requires one of the following scopes: ['read:org'], but your token has only been granted the: ['repo'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."}
{"type":"INSUFFICIENT_SCOPES","locations":[{"line":1,"column":1622}],"message":"Your token has not been granted the required scopes to execute this query. The 'name' field requires one of the following scopes: ['read:org'], but your token has only been granted the: ['repo'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."}
{"type":"INSUFFICIENT_SCOPES","locations":[{"line":1,"column":1627}],"message":"Your token has not been granted the required scopes to execute this query. The 'email' field requires one of the following scopes: ['read:org'], but your token has only been granted the: ['repo'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens."}
at com.bigbrassband.jira.git.services.integration.utils.graphql.BaseResponseHandler.parseError(BaseResponseHandler.java:104)
at com.bigbrassband.jira.git.services.integration.utils.graphql.BaseResponseHandler.parseResponse(BaseResponseHandler.java:64)
at com.bigbrassband.jira.git.services.integration.utils.graphql.BaseResponseHandler.handle(BaseResponseHandler.java:52)
at com.bigbrassband.jira.git.services.integration.github.GitHubGraphQLClient.lambda$wrapByRateLimitHandler$7(GitHubGraphQLClient.java:371)
at com.bigbrassband.jira.git.services.integration.utils.GraphQlClient.runRequest(GraphQlClient.java:97)
at com.bigbrassband.jira.git.services.integration.utils.GraphQlClient.executeQuery(GraphQlClient.java:84)
at com.bigbrassband.jira.git.services.integration.github.GitHubGraphQLClient.executeQuery(GitHubGraphQLClient.java:361)
at com.bigbrassband.jira.git.services.integration.github.GitHubGraphQLClient.getPullRequestsTimeline(GitHubGraphQLClient.java:270)
at com.bigbrassband.jira.git.services.integration.github.GitHubGraphQLClient.getPullRequestsTimeline(GitHubGraphQLClient.java:158)
at com.bigbrassband.jira.git.services.integration.github.GitHubApi.getMergeRequestsTimeline(GitHubApi.java:296)
... 20 more
Diagnosis
You are getting this error because of missing permission scopes.
Two new options are now available in General Settings. Enabling these options requires an “extended” scope for your PATs.
Solution
To utilize the new GitHub share PR events, we recommend that users must update their personal access token to have the following scopes:
read:discussion
read:org
read:user
repo
(all)user:email
If you still have a question – reach out to our Support Desk or email us at [email protected].
More articles about troubleshooting, workarounds and solutions
Why I am getting the error, “git-upload-pack not permitted”?
Cannot auto-deploy some tracked repositories: Specified origin is incorrect or not supported
Connection Reset when Accessing the Database
“Dangerous use of multiple connections” error on local database
Duplicate entry 0 for key PRIMARY exceptions in log
Error while reindexing – Java heap space / Object too large, rejecting the pack
Gitolite integration: Why the Git integration app not see the master branch?
Health Check: Database Collation
Indexing error – Too many open files
Installation fails when installing manually
Jira index error: IndexNotFoundException: no segments* file found
Malformed input or input contains unmappable characters
Personal access token failing Azure DevOps integration with Not Authorized error
Problems with shared home on Azure Storage
Pull request index error: org.json.JSONException
Repositories missing from Azure DevOps integration
“Service proxy has been destroyed” exceptions in log
SQLException ‘Incorrect string value’ in merge requests
SSH key file format is invalid
TFS – Not authorized exception when Jira works thru proxy
Unexpected exception parsing XML document from URL error in log
Why don’t I see the Create Branch or Pull Request features?
Your token has not been granted the required scopes (this page)