DVCS sync to GitHub fails with "Parse exception converting JSON to object" error

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

After adding an organization to DVCS, it never loads the repositories.

Diagnosis

In atlassian-jira.log, we see the following errors:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 2023-05-04 15:05:00,283-0300 Caesium-1-2 WARN ServiceRunner [c.a.j.p.d.spi.github.GithubClientWithTimeout] Failed to execute request [GET /orgs/myorg /repos] errors: Parse exception converting JSON to object java.io.IOException: Parse exception converting JSON to object at org.eclipse.egit.github.core.client.GitHubClient.parseJson(GitHubClient.java:424) at org.eclipse.egit.github.core.client.GitHubClient.parseJson(GitHubClient.java:403) at org.eclipse.egit.github.core.client.GitHubClient.parseError(GitHubClient.java:514) at org.eclipse.egit.github.core.client.GitHubClient.createException(GitHubClient.java:547) at org.eclipse.egit.github.core.client.GitHubClient.get(GitHubClient.java:740) at com.atlassian.jira.plugins.dvcs.spi.github.GithubClientWithTimeout.lambda$get$0(GithubClientWithTimeout.java:67) at com.atlassian.jira.plugins.dvcs.spi.github.GithubClientWithTimeout.executeRequest(GithubClientWithTimeout.java:103) at com.atlassian.jira.plugins.dvcs.spi.github.GithubClientWithTimeout.get(GithubClientWithTimeout.java:67) at org.eclipse.egit.github.core.client.PageIterator.next(PageIterator.java:173) at org.eclipse.egit.github.core.service.GitHubService.getAll(GitHubService.java:151) at org.eclipse.egit.github.core.service.RepositoryService.getOrgRepositories(RepositoryService.java:348) at org.eclipse.egit.github.core.service.RepositoryService.getOrgRepositories(RepositoryService.java:300) at com.atlassian.jira.plugins.dvcs.spi.github.GithubCommunicator.getRepositories(GithubCommunicator.java:178) at com.atlassian.jira.plugins.dvcs.service.remote.CachingCommunicator.getRepositories(CachingCommunicator.java:140) at com.atlassian.jira.plugins.dvcs.service.RepositorySyncServiceImpl.getAllRemoteRepositories(RepositorySyncServiceImpl.java:284) at com.atlassian.jira.plugins.dvcs.service.RepositorySyncServiceImpl.reconcileRepoList(RepositorySyncServiceImpl.java:127) at com.atlassian.jira.plugins.dvcs.service.RepositorySyncServiceImpl.syncRepositoryList(RepositorySyncServiceImpl.java:211) at com.atlassian.jira.plugins.dvcs.scheduler.organizations.OrganizationRepoSyncJob.runJob(OrganizationRepoSyncJob.java:47) at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134) at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106) at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:435) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:430) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJobWithRecoveryGuard(CaesiumSchedulerService.java:454) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:382) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 1 at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) at com.google.gson.Gson.fromJson(Gson.java:790) at com.google.gson.Gson.fromJson(Gson.java:756) at org.eclipse.egit.github.core.client.GitHubClient.parseJson(GitHubClient.java:422) ... 28 more at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:364) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:165) ... 31 more 2023-05-04 15:05:00,286-0300 Caesium-1-2 INFO ServiceRunner [c.a.j.p.dvcs.service.RepositorySyncServiceImpl] Fetching all remote repositories for organization [myorg ] took 0s 2023-05-04 15:05:00,287-0300 Caesium-1-2 ERROR ServiceRunner [c.a.j.p.dvcs.service.RepositorySyncServiceImpl] Failed to synchronize list of repositories for organization [myorg ] com.atlassian.jira.plugins.dvcs.exception.SourceControlException: Error retrieving list of repositories at com.atlassian.jira.plugins.dvcs.spi.github.GithubCommunicator.getRepositories(GithubCommunicator.java:188) at com.atlassian.jira.plugins.dvcs.service.remote.CachingCommunicator.getRepositories(CachingCommunicator.java:140) at com.atlassian.jira.plugins.dvcs.service.RepositorySyncServiceImpl.getAllRemoteRepositories(RepositorySyncServiceImpl.java:284) at com.atlassian.jira.plugins.dvcs.service.RepositorySyncServiceImpl.reconcileRepoList(RepositorySyncServiceImpl.java:127) at com.atlassian.jira.plugins.dvcs.service.RepositorySyncServiceImpl.syncRepositoryList(RepositorySyncServiceImpl.java:211) at com.atlassian.jira.plugins.dvcs.scheduler.organizations.OrganizationRepoSyncJob.runJob(OrganizationRepoSyncJob.java:47) at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134) at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106) at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:435) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:430) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJobWithRecoveryGuard(CaesiumSchedulerService.java:454) at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:382) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60) at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35) at java.base/java.lang.Thread.run(Thread.java:829) Caused by: java.io.IOException: Parse exception converting JSON to object at org.eclipse.egit.github.core.client.GitHubClient.parseJson(GitHubClient.java:424) at org.eclipse.egit.github.core.client.GitHubClient.parseJson(GitHubClient.java:403) at org.eclipse.egit.github.core.client.GitHubClient.parseError(GitHubClient.java:514) at org.eclipse.egit.github.core.client.GitHubClient.createException(GitHubClient.java:547) at org.eclipse.egit.github.core.client.GitHubClient.get(GitHubClient.java:740) at com.atlassian.jira.plugins.dvcs.spi.github.GithubClientWithTimeout.executeRequest(GithubClientWithTimeout.java:103) at com.atlassian.jira.plugins.dvcs.spi.github.GithubClientWithTimeout.get(GithubClientWithTimeout.java:67) at org.eclipse.egit.github.core.client.PageIterator.next(PageIterator.java:173) at org.eclipse.egit.github.core.service.GitHubService.getAll(GitHubService.java:151) at org.eclipse.egit.github.core.service.RepositoryService.getOrgRepositories(RepositoryService.java:348) at org.eclipse.egit.github.core.service.RepositoryService.getOrgRepositories(RepositoryService.java:300) at com.atlassian.jira.plugins.dvcs.spi.github.GithubCommunicator.getRepositories(GithubCommunicator.java:178) ... 16 more Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 1 at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) at com.google.gson.Gson.fromJson(Gson.java:790) at com.google.gson.Gson.fromJson(Gson.java:756) at org.eclipse.egit.github.core.client.GitHubClient.parseJson(GitHubClient.java:422)

Cause

When configuring the organization a trailing space was added.

In the example for the logs above, the organization was added as "myorg ".

Solution

Remove the organization and add it again without the space at the end.

Updated on March 21, 2025

Still need help?

The Atlassian Community is here for you.