# Troubleshooting

Knowing where to begin looking for information is the first step to reaching out for help. Many answers to commonly found problems can be found on the [SonarQube for IDE channel of the Sonar community forum](https://community.sonarsource.com/c/sl/11). See below for the basic steps to access the SonarQube for IDE logs when the analysis results are not what you expected.

Before posting to the Sonar community, make sure that you have your logs ready by following the instructions below.

## How to get SonarQube for Eclipse logs <a href="#how-to-get-sonarlint-logs" id="how-to-get-sonarlint-logs"></a>

* Open the Eclipse **Console** view.
* Open the **SonarQube Console**.
* Behind the double-gear dropdown menu in the **Console** view, enable **Verbose output**.
* Reproduce the issue; for example, reopen the offending file.

<div align="left"><figure><img src="https://231328848-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkadXEH8HkykK7lKaDvVq%2Fuploads%2FYMVWuLTzopx42izPc4yB%2Fsq-eclipse-show-verbose-output.png?alt=media&#x26;token=429cbfc8-269b-4090-8b40-b33dc469c861" alt="Enable the Verbose output in SonarQube for Eclipse to help troubleshoot problems with your analysis." width="563"><figcaption></figcaption></figure></div>

**IDE-specific traces** are useful when troubleshooting only when Eclipse-specific activity is related to SonarQube for Eclipse errors.

### How to get the Eclipse logs <a href="#how-to-get-the-eclipse-logs" id="how-to-get-the-eclipse-logs"></a>

Sometimes errors are not in the SonarQube for Eclipse console but could be directly in Eclipse error logs.

* Open Eclipse **Error Log** view: go to Eclipse > **Window** > **Show view** > **Other…** > **General** and select **Error Log** from the list
* Look for an error event related to SonarQube for Eclipse
* Open event details to get the stacktrace

## How to get SonarQube for Eclipse thread dumps <a href="#how-to-get-sonarlint-thread-dumps" id="how-to-get-sonarlint-thread-dumps"></a>

In some cases, it can be useful to extract thread dumps from the running instance of your IDE for debugging; thread dumps can help us investigate UI freeze issues or threading problems.

If SonarQube for IDE does not start or stops working and the IDE is still running, thread dumps are necessary to properly troubleshoot the problem *before the IDE is restarted*. If you restart the IDE, some information about what was happening when it failed will be lost. Fortunately, thread dumps are easy to obtain for both SonarQube for IDE and your IDE.

Once obtained, please report your error to the [Sonar community forum](https://community.sonarsource.com/c/sl/eclipse/34). Your thread dump may contain sensitive details and if it’s required for further troubleshooting, it will be possible to share your thread dump privately.

### **Getting an IDE thread dump**

You must first get the process ID for your IDE, then export the thread dump. The `jps` and `jstack` commands below are utilities that come bundled with the Java JDK.

1. While SonarQube for Eclipse is running, run `jps` in your terminal to see a list of process IDs (PID).
2. Note the PID of `Eclipse`.
3. Run `jstack -F -l <`*`PROCESS_ID`*`> > eclipse_thread_dump.txt` to get the thread dump.

### **Getting a SonarQube for Eclipse thread dump**

Getting the process ID for SonarQube for Eclipse is the same as for the IDE; simply note the ID for `SonarLintServerCli` or run the command again, then export the thread dump. The `jps` and `jstack` commands below are utilities that come bundled with the Java JDK.

1. While SonarQube for Eclipse is running, run `jps` in your terminal to see a list of process IDs (PID).
2. Note the PID of `SonarLintServerCli`.
3. Run `jstack -F -l <`*`PROCESS_ID`*`> > sonarqube-for-eclipse_thread-dump.txt` to get the thread dump.

## Troubleshooting connected mode setup <a href="#troubleshooting-connected-mode-setup" id="troubleshooting-connected-mode-setup"></a>

### **No matching project found**

No matching project is found because:

* It’s best if you already have the project open in your IDE, otherwise SonarQube for Eclipse might not be able to find a matching file.
* SonarQube for Eclipse can get confused if you have multiple projects open in the workspace. Please open or choose the correct project and try again.

If these solutions don’t help, follow the instructions for [#project-binding](https://docs.sonarsource.com/sonarqube-for-eclipse/connect-your-ide/setup#project-binding "mention") to manually configure your project binding.

### **No matching issue found**

SonarQube for Eclipse can’t find your issue because:

* You might not be on the same branch.
* The issue was fixed, or the source code may be different from the analyzed version.

## Troubleshooting unexpected analysis results <a href="#troubleshooting-unexpected-analysis-results" id="troubleshooting-unexpected-analysis-results"></a>

Sometimes, issues found on the server differ from those found locally by SonarQube for IDE. Usually, the server-side rule configuration (your quality profile) is to blame; however, it could be something more than that. Maybe your local build configuration and system dependencies don’t align with your DevOps pipeline, or it could simply be that the issue, due to its complexity, is only detectable by SonarQube Server or SonarQube Cloud.

The collapsible below lists some of the most commonly encountered reasons, along with some details that will help you troubleshoot discrepancies.

<details>

<summary>Why your local analysis might be different than found on the server</summary>

**Some issues might be detected by third-party analyzers**

SonarQube for IDE will only run rules from Sonar analyzers including [custom rules extending Sonar analyzers](https://docs.sonarsource.com/sonarqube-server/extension-guide/adding-coding-rules). Third-party analyzers usually have their own IDE integration, and there is no plan to run them inside of SonarQube for IDE.

**Your test files might be mistaken as source files**

Test files can be defined in SonarQube (Server, Cloud) or SonarQube Community Build at either the project or global levels. In addition, test files can be defined in the IDE however, each IDE handles test files a bit differently:

* For example, SonarQube for Visual Studio does not distinguish between project and test code, and SonarQube for IntelliJ relies on the IDE to detect if a file is a test file. In the case where the IntelliJ IDE detects the test file for SonarQube for IntelliJ:
  * *The file is under a test sources root*. Those roots can be manually created by users or automatically populated by the IDE by relying on the build system such as Maven or Gradle, for example.
  * *The file is flagged as a test file by any plugin that you have installed*. The IDE bundles some internal plugins like the "JavaScript and TypeScript" plugin; these internal plugins can infer if a file should be considered as a test file. Third-party plugins can also infer test files, and SonarQube for IDE will recognize these as such.

Please review your IDE's page about [file-exclusions](https://docs.sonarsource.com/sonarqube-for-eclipse/using/file-exclusions "mention") and check these pages to define your analysis scope on the server:

* [Setting analysis scope](https://app.gitbook.com/s/LWhbesChsC4Yd1BbhHhS/project-administration/adjusting-analysis/setting-analysis-scope "mention") at the project level in SonarQube Server
* Setting your [Analysis scope](https://app.gitbook.com/s/B4UT2GNiZKjtxFtcFAL7/managing-your-projects/project-analysis/setting-analysis-scope "mention") at the project level in SonarQube Cloud
* [Setting analysis scope](https://app.gitbook.com/s/bqrfLGeD0Y9vE5l9Le42/project-administration/adjusting-analysis/setting-analysis-scope "mention") at the project level in SonarQube Community Build

**Some rules are too complex to run locally**

Some rules can report issues at the project level or require extensive resources to analyze, such as injection vulnerabilities and some advanced bug detection rules; such issues are not displayed in SonarQube for IDE, only in SonarQube (Server, Cloud). See the article on [#unsupported-rules](https://docs.sonarsource.com/sonarqube-for-eclipse/using/rules#unsupported-rules "mention") for more detail.

Please check the [SonarQube for IDE roadmap](https://www.sonarsource.com/products/sonarqube/ide/roadmap/) for a list of features on the horizon.

**File or language types are not supported**

Check your IDE’s **Rules and languages** page for a list of supported languages and file types.

**The analyzer version may be different**

Improvements are constantly being made to the Sonar analyzers during the CI/CD development cycle. Depending on the product version you are running, you may have a different analyzer therefore, the results might be different.

* SonarQube Cloud is always running the latest analyzers.
* SonarQube Server and SonarQube Community Build run the latest available analyzer at the time of its release.
* SonarQube for IDE runs the latest available analyzer at the time of its release.
* Sometimes SonarQube for IDE downloads and uses the same SonarQube Server or SonarQube Cloud analyzer when running in connected mode.

**Your project configuration may be different**

Discrepancies in C and C++ analysis may result from different project builds and system dependencies. For example, you might have one set up in your local build configuration and another set up for your CI build configuration (or the configuration created by Autoscan).

</details>

### Language-specific examples

<details>

<summary>JavaScript and TypeScript analysis</summary>

**Performance issues**

When analyzing JavaScript/TypeScript files that don't belong to a `tsconfig.json` file (referred to as 'orphan' files), you might encounter performance issues such as the analyzer stalling or consuming excessive memory. This might occur because SonarQube is creating a large number of TypeScript Programs for these orphan files, a situation indicated by log messages like "No tsconfig found for files, using default options …"

To resolve this, try setting the `sonar.javascript.createTSProgramForOrphanFiles` flag to `false` (the default setting is `true`) to create these programs. Changing it to `false` is recommended when performance issues are observed.

This new, more targeted solution replaces the older property, `sonar.javascript.sonarlint.typechecking.maxfiles`, which has been removed.

</details>

## FAQ <a href="#faq" id="faq"></a>

**Are my SonarScanner properties applied to SonarQube for Eclipse?**

No. Scanner properties you may have defined in the `sonar-project.properties` or `pom.xml` files (for example `sonar.sources` or `sonar.projectBasedir`) only make sense when modifying the SonarScanner in the command line. SonarQube for Eclipse tries to use IDE metadata to avoid other configurations.

If you want to share some configuration between SonarScanners and SonarQube for Eclipse, like [file-exclusions](https://docs.sonarsource.com/sonarqube-for-eclipse/using/file-exclusions "mention"), or some specific analyzer properties (see [scan-my-project](https://docs.sonarsource.com/sonarqube-for-eclipse/using/scan-my-project "mention")), the best way is to use [connected-mode](https://docs.sonarsource.com/sonarqube-for-eclipse/connect-your-ide/connected-mode "mention") and set the configuration in the SonarQube (Server, Cloud) or SonarQube Community Build UI.
