# IntelliJ SonarLint Plugin: Failed to update project

**URL:** <https://community.sonarsource.com/t/intellij-sonarlint-plugin-failed-to-update-project/51549>\
**Category:** SonarQube Server / Community Build\
**Tags:** intellij, sonarqube, sonarqube-ide\
**Created:** [October 15, 2021, 12:28pm UTC](https://community.sonarsource.com/t/intellij-sonarlint-plugin-failed-to-update-project/51549 "2021-10-15T12:28:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![newlukai](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@newlukai](https://community.sonarsource.com/u/newlukai)\
**Post date:** [October 15, 2021, 12:28pm UTC](https://community.sonarsource.com/t/intellij-sonarlint-plugin-failed-to-update-project/51549/1 "2021-10-15T12:28:50Z")

</div>

# Versions

- SonarQube: 8.9.2.46101
- IntelliJ: 2021.2.2 (Runtime version 11.0.12)
- SonarLint Plugin: 6.0.0.37696

# error observed

I tried to bind a new project and got the following error:

 ![grafik](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/b/d/bddd239e5f44e931a8b9765fa132849954d04c22.png)

But even after updating the server bindings I get this message. Which is quite interesting since I chose the project from the project list.

# steps to reproduce

I tried to analyze what’s going wrong and got the hint that there is a Verbose Output option for the Log window. So I enabled it and got the following:

```auto
Project 'a' in server binding 'SonarQube' updated
GET 200 https://…/sonarqube/api/qualityprofiles/search.protobuf?project=b | response time=37ms
Downloaded project quality profiles in 37ms
GET 200 https://…/sonarqube/api/settings/values.protobuf?component=b | response time=24ms
Downloaded settings in 25ms
Page downloaded in 27ms
GET 200 https://…/sonarqube/batch/issues?key=b | response time=24ms
null
java.lang.NullPointerException
	at java.base/java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:108)
	at org.sonarlint.intellij.http.ApacheHttpResponse.bodyAsStream(ApacheHttpResponse.kt:35)
	at org.sonarlint.intellij.http.ApacheHttpResponse.bodyAsStream(ApacheHttpResponse.kt:26)
	at org.sonarsource.sonarlint.core.serverapi.issue.IssueApi.lambda$downloadAllFromBatchIssues$4(IssueApi.java:121)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processTimed(ServerApiHelper.java:221)
	at org.sonarsource.sonarlint.core.serverapi.issue.IssueApi.downloadAllFromBatchIssues(IssueApi.java:113)
	at org.sonarsource.sonarlint.core.container.connected.update.IssueDownloader.download(IssueDownloader.java:79)
	at org.sonarsource.sonarlint.core.container.connected.update.perform.ServerIssueUpdater.updateServerIssues(ServerIssueUpdater.java:52)
	at org.sonarsource.sonarlint.core.container.connected.update.perform.ProjectStorageUpdateExecutor.updateServerIssues(ProjectStorageUpdateExecutor.java:102)
	at org.sonarsource.sonarlint.core.container.connected.update.perform.ProjectStorageUpdateExecutor.lambda$update$0(ProjectStorageUpdateExecutor.java:62)
	at org.sonarsource.sonarlint.core.client.api.util.FileUtils.replaceDir(FileUtils.java:233)
	at org.sonarsource.sonarlint.core.container.connected.update.perform.ProjectStorageUpdateExecutor.update(ProjectStorageUpdateExecutor.java:60)
	at org.sonarsource.sonarlint.core.container.connected.ConnectedContainer.updateProject(ConnectedContainer.java:140)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.updateProject(ConnectedSonarLintEngineImpl.java:286)
	at org.sonarlint.intellij.tasks.BindingStorageUpdateTask.updateProject(BindingStorageUpdateTask.java:181)
	at org.sonarlint.intellij.tasks.BindingStorageUpdateTask.updateProjects(BindingStorageUpdateTask.java:157)
	at org.sonarlint.intellij.tasks.BindingStorageUpdateTask.run(BindingStorageUpdateTask.java:110)
	at org.sonarlint.intellij.tasks.BindingStorageUpdateTask$2.run(BindingStorageUpdateTask.java:85)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:450)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:117)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:510)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:243)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:183)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:170)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:243)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:829)

```

SonarQube sends a 200, but an NPE is thrown? Interesting. So I opened a browser and hit that URL and got a response: a 0 byte “issues” file. This project has no issues.

# potential workaround

Unbind the project?

I’m not sure, but quite convinced, that there is a bug receiving a 0 byte file from SonarQube. Might that be possible?

---

<div class="post-metadata">

**Author:** ![newlukai](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@newlukai](https://community.sonarsource.com/u/newlukai)\
**Post date:** [October 18, 2021, 8:23am UTC](https://community.sonarsource.com/t/intellij-sonarlint-plugin-failed-to-update-project/51549/2 "2021-10-18T08:23:09Z")

</div>

The [sonarlint-intellij](https://github.com/SonarSource/sonarlint-intellij/blob/96722ed4d3f1c1d3bac966511fee034826484ab8/src/main/java/org/sonarlint/intellij/http/ApacheHttpResponse.kt#L35) plugin extracts the `bodyBytes` of the response and uses it as constructor parameter for `ByteArrayInputStream`.  
I guess the `bodyBytes` are `null`. I tried to verify in the HttpClient5 source code that an empty server response would lead to a `null` `bodyBytes` member. But I wasn’t able to figure this out, I was not able to find the place(s) where responses are received and the corresponding objects built.

---

<div class="post-metadata">

**Author:** ![Damien\_Urruty](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/damien_urruty/32/43383_2.png) [@Damien\_Urruty](https://community.sonarsource.com/u/Damien_Urruty)\
**Post date:** [October 20, 2021, 9:40am UTC](https://community.sonarsource.com/t/intellij-sonarlint-plugin-failed-to-update-project/51549/3 "2021-10-20T09:40:08Z")

</div>

Hello,

Welcome to the community and thanks for raising this issue.

I am not able to reproduce, it works on my side if there is no issue on the server. But indeed your analysis is correct and `bodyBytes` is nullable, so I think in certain cases it can cause an exception.

I created this [ticket](https://jira.sonarsource.com/browse/SLI-626) to fix the problem.

Thanks again for reporting!

---

<div class="post-metadata">

**Author:** ![newlukai](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@newlukai](https://community.sonarsource.com/u/newlukai)\
**Post date:** [October 21, 2021, 6:19am UTC](https://community.sonarsource.com/t/intellij-sonarlint-plugin-failed-to-update-project/51549/4 "2021-10-21T06:19:03Z")

</div>

Thanks for investigating on this. It’s puzzling me that you can’t reproduce this. But I’m absolutely fine waiting for this change.

---

<div class="post-metadata">

**Author:** ![JBL\_SonarSource](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/jbl_sonarsource/32/64_2.png) [@JBL\_SonarSource](https://community.sonarsource.com/u/JBL_SonarSource)\
**Post date:** [November 10, 2021, 1:53pm UTC](https://community.sonarsource.com/t/intellij-sonarlint-plugin-failed-to-update-project/51549/5 "2021-11-10T13:53:10Z")

</div>

Hello, FYI version 6.2.0.39326 which includes a fix for the aforementioned issue has just been published to the JetBrains plugin repository.

---

<div class="post-metadata">

**Author:** ![newlukai](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@newlukai](https://community.sonarsource.com/u/newlukai)\
**Post date:** [November 10, 2021, 2:53pm UTC](https://community.sonarsource.com/t/intellij-sonarlint-plugin-failed-to-update-project/51549/6 "2021-11-10T14:53:56Z")

</div>

Works now. Thank you very much!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [November 17, 2021, 2:54pm UTC](https://community.sonarsource.com/t/intellij-sonarlint-plugin-failed-to-update-project/51549/7 "2021-11-17T14:54:06Z")

</div>

Closed on November 17, 2021, 2:54pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
