# SonarLint Kotlin analyzer crashes on large Android project (Internal error / parse failure) but work

**URL:** <https://community.sonarsource.com/t/sonarlint-kotlin-analyzer-crashes-on-large-android-project-internal-error-parse-failure-but-work/177138>\
**Category:** IntelliJ Platform\
**Tags:** kotlin, sonarqube, sonarqube-ide, scanner\
**Created:** [February 2, 2026, 9:04pm UTC](https://community.sonarsource.com/t/sonarlint-kotlin-analyzer-crashes-on-large-android-project-internal-error-parse-failure-but-work/177138 "2026-02-02T21:04:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![devilyoung2504](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/devilyoung2504/32/74826_2.png) [@devilyoung2504](https://community.sonarsource.com/u/devilyoung2504)\
**Post date:** [February 2, 2026, 9:04pm UTC](https://community.sonarsource.com/t/sonarlint-kotlin-analyzer-crashes-on-large-android-project-internal-error-parse-failure-but-work/177138/1 "2026-02-02T21:04:15Z")

</div>

Hello Sonar team 👋,

I’m facing a persistent SonarLint analysis failure on a large Android project.  
After extensive troubleshooting, this looks like a Kotlin analyzer incompatibility rather than a project misconfiguration.

I’ll try to be as precise and reproducible as possible.

* * *

## Environment

• OS: macOS 26.2 (Apple Silicon)  
• IDE: Android Studio Otter 3 Feature Drop | 2025.2.3  
Build #AI-252.28238.7.2523.14688667 (Jan 9, 2026)  
• Runtime: 21.0.8±14196175-b1038.72 (JetBrains)  
• JVM: OpenJDK 64-Bit Server VM by JetBrains  
• Memory: 5 GB  
• Cores: 10  
• Metal rendering: ON

### Installed non-bundled plugins

• SonarLint for IntelliJ: 11.12.0.84088  
• Snyk  
• Anthropic Code plugin  
• JetBrains Marketplace  
• Full Line Completion

* * *

## Project characteristics

• Android multi-module project  
• ~900+ Kotlin source files  
• Mix of Java + Kotlin  
• Uses modern Kotlin features  
• Gradle build **syncs and compiles successfully**  
• No syntax errors (verified)

* * *

## Kotlin / Gradle setup

• AGP: 8.10.0  
• Kotlin versions tested:

- 2.2.21
- 2.1.21  
• KSP versions tested:
- 2.2.20-2.0.3
- 2.1.21-1.0.20  
• Gradle: 8.14.3  
• JDK for Gradle: Java 21 (Amazon Corretto / JetBrains runtime)

Build works fine in all cases.

* * *

## The problem

SonarLint **always fails during Kotlin analysis** with an internal error.

Typical behavior:  
• Java analysis completes successfully  
• Kotlin analysis starts (hundreds of files)  
• Analysis crashes with:

- `ResponseErrorException: Internal error`
- `Error during analysis`  
• Sometimes it hangs, sometimes it fails immediately

Relevant log excerpt:

[sonarlint-analysis-scheduler] INFO ProgressReport - 935 source files to be analyzed  
… then analysis fails with internal error

* * *

## Important observations

✔ SonarLint works **perfectly** on:  
• Small Android/Kotlin projects  
• Same IDE  
• Same SonarLint version  
• Same machine

❌ SonarLint fails **only** on this large project.

✔ Binding vs disconnected mode:  
• Connected mode → fails  
• Disconnected mode → fails  
• Same result

✔ Kotlin K2 mode:  
• K2 OFF → analysis often hangs  
• K2 ON → analysis progresses further but still crashes

✔ File exclusions / scope limiting:  
• Tried sonar.inclusions / sonar.exclusions  
• Tried limiting to a single package  
• Tried excluding build/, generated/, res/, assets/  
• Analyzer still crashes globally

✔ Cache & reinstall attempts:  
• Removed all SonarLint caches  
• Fully uninstalled plugin  
• Deleted ~/.sonarlint  
• Reinstalled plugin cleanly  
• Same result

✔ Comparison with teammate:  
• Same repo  
• Same SonarLint version  
• Works on teammate’s machine  
• Suggests environment + Kotlin analyzer interaction

* * *

## What this suggests

This does **not** appear to be:  
• A Gradle issue  
• A Kotlin syntax issue  
• A project configuration issue

It **does** appear to be:  
• A Kotlin analyzer bug triggered by:

- Project size
- Specific Kotlin constructs
- Or Kotlin/K2/IDE compatibility

* * *

## Question

1. Is there a known incompatibility between:

2. Is there any way to:

3. Would providing a minimal reproducer (subset of files) help?

I’m happy to provide additional logs or isolate problematic files if needed.

Thanks a lot for your time and for maintaining SonarLint 🙏

---

<div class="post-metadata">

**Author:** ![devilyoung2504](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/devilyoung2504/32/74826_2.png) [@devilyoung2504](https://community.sonarsource.com/u/devilyoung2504)\
**Post date:** [February 2, 2026, 9:06pm UTC](https://community.sonarsource.com/t/sonarlint-kotlin-analyzer-crashes-on-large-android-project-internal-error-parse-failure-but-work/177138/2 "2026-02-02T21:06:31Z")

</div>

To help with reproducing this reliably, here are some additional observations and constraints that might clarify the behavior:

* * *

### 🔍 Reproduction conditions that trigger the crash

✔ This happens only on **large Android projects** with hundreds of Kotlin files.  
✔ On a **small Kotlin project** (same IDE + same SonarLint version + same machine) the analysis runs cleanly in all modes (connected / disconnected / K2 ON / K2 OFF).  
✔ On the large project (the real codebase), the crash always occurs when the Kotlin analysis attempts to start (after Java analysis finishes).

* * *

### 🧪 Attempts already made

These steps have already been tried and all produce the same crash:

1. **Clean reinstall of SonarLint plugin**

2. **Clearing all IDE caches**

3. **Multiple Kotlin / KSP versions**

4. **JDK alignment**

5. **Analysis variations**

6. **Inclusions / exclusions adjusted**

7. **Scoped analysis**

* * *

### 📌 What _doesn’t_ appear to be the cause

❌ Not a Gradle build error  
❌ Not a pure syntax issue (small test cases compile)  
❌ Not a caching leftover  
❌ Not solely a plugin install issue  
❌ Not a JVM mismatch

* * *

### 🧩 Additional context

• Android Studio Otter 3 Feature Drop | 2025.2.3  
Runtime: Java 21.0.8  
macOS 26.2 (arm64)

• SonarLint 11.12.0

• Java analysis always completes successfully  
• Kotlin analysis always reaches hundreds of files before crashing

• Logs indicate:

…  
INFO ProgressReport - X source files to be analyzed  
… then internal error / parser failure

• Teammate on same project + same SonarLint + same IDE version does _not_ see the crash — so environment alone likely isn’t the full cause.

* * *

### ❓Questions that would help pinpoint the issue

1. Is there a known limitation in sonar-kotlin analyzer for large Kotlin codebases?
2. Are there specific Kotlin/K2 constructs that cause internal parser failures in SonarLint?
3. Are there flags to run Kotlin analysis with more logging (DEBUG/TRACE) that can expose where the crash happens?
4. Could this be a memory/streaming issue when indexing large Kotlin sources?
5. Is there a way to disable just the Kotlin analyzer in SonarLint to narrow down the execution?

* * *

I can provide more logs (debug), a minified repro, or GitHub access snippet if needed.

Happy to help further to nail this down 💪

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [February 3, 2026, 12:56pm UTC](https://community.sonarsource.com/t/sonarlint-kotlin-analyzer-crashes-on-large-android-project-internal-error-parse-failure-but-work/177138/3 "2026-02-03T12:56:48Z")

</div>

Hi,

Welcome to the community and thanks for this very thorough report!

Could you give us a [verbose log](https://docs.sonarsource.com/sonarqube-for-intellij/resources/troubleshooting) from IDE startup through to the error, please?

&nbsp;  
Thx!  
Ann

---

<div class="post-metadata">

**Author:** ![devilyoung2504](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/devilyoung2504/32/74826_2.png) [@devilyoung2504](https://community.sonarsource.com/u/devilyoung2504)\
**Post date:** [February 3, 2026, 1:37pm UTC](https://community.sonarsource.com/t/sonarlint-kotlin-analyzer-crashes-on-large-android-project-internal-error-parse-failure-but-work/177138/5 "2026-02-03T13:37:40Z")

</div>

[Diagnostics Report 2026 02 03 - 084218.zip](https://community.sonarsource.com/uploads/short-url/r4wPmdTtGGuviXXsyv5ptgbTzxc.zip) (809.9 KB)

[sonarlog.txt](https://community.sonarsource.com/uploads/short-url/thp5pEkBcsCBvyZ2y2bKI1V0lsR.txt) (1 MB)

Hi Ann,

I collected a full diagnostic report using **Help → Collect logs and diagnostic data** , and I’m attaching it (zip).  
I’m also attaching the Sonar log output from the IDE (sonarlog.txt).

The Kotlin analysis fails on multiple `.kt` files with:  
`null cannot be cast to non-null type org.jetbrains.kotlin.psi.KtFile`  
e.g. `EditSaleActivity.kt`, `CountriesModel.kt`, etc.

Environment: Android Studio Otter 3 Feature Drop (2025.2.3), SonarQube for IDE 11.12.0, macOS aarch64.

Thanks!

---

<div class="post-metadata">

**Author:** ![ganncamp](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/ganncamp/32/1261_2.png) [@ganncamp](https://community.sonarsource.com/u/ganncamp)\
**Post date:** [February 3, 2026, 1:58pm UTC](https://community.sonarsource.com/t/sonarlint-kotlin-analyzer-crashes-on-large-android-project-internal-error-parse-failure-but-work/177138/6 "2026-02-03T13:58:25Z")

</div>

Hi,

Thanks! This is flagged for the team.

&nbsp;  
Ann

---

<div class="post-metadata">

**Author:** ![devilyoung2504](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/devilyoung2504/32/74826_2.png) [@devilyoung2504](https://community.sonarsource.com/u/devilyoung2504)\
**Post date:** [February 3, 2026, 2:11pm UTC](https://community.sonarsource.com/t/sonarlint-kotlin-analyzer-crashes-on-large-android-project-internal-error-parse-failure-but-work/177138/7 "2026-02-03T14:11:49Z")

</div>

Thanks, Ann!  
I’ll wait for your team’s feedback. Let me know if you need any additional logs or tests on my side. 🙂

---

<div class="post-metadata">

**Author:** ![peter.trifanov](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/peter.trifanov/32/53693_2.png) [@peter.trifanov](https://community.sonarsource.com/u/peter.trifanov)\
**Post date:** [February 16, 2026, 3:19pm UTC](https://community.sonarsource.com/t/sonarlint-kotlin-analyzer-crashes-on-large-android-project-internal-error-parse-failure-but-work/177138/16 "2026-02-16T15:19:50Z")

</div>

Hello @devilyoung2504 , and thank you for a detailed report!

I think I have an understanding where the problem is located. In your logs, I can see that your project path contains a directory `Work Projects` with a white space. Apparently, we have a small discrepancy in how we are connecting Sonar filesystem API with the Kotlin Analysis API, where special symbols are escaped differently on different sides.

Could you please try to rerun analysis on the same project, but in a directory where the entire full path doesn’t contain special symbols like white spaces? Could you please also confirm if the other projects where you tested this did or did not contain special symbols in path?

In the meantime, I’m working on a fix on the analyzer’s side, and it should be included with the next release.

Cheers,

Peter
