Fix analytics ServiceConfigurationError on IDEs that bundle their own ktor (2025.2+/2026.1)#174
Merged
Pushpavel merged 1 commit intoJul 12, 2026
Conversation
On 2025.2+ IDEs (RustRover, CLion 2026.1, ...) the platform ships its own ktor in lib/ (intellij.libraries.ktor.client.cio.jar). Creating the analytics HttpClient without naming an engine makes ktor discover one through java.util.ServiceLoader, and the plugin classloader's resource lookup also sees the platform's service file: it then tries to load the platform's CIOEngineContainer, which implements the platform copy of HttpClientEngineContainer rather than the one bundled with the plugin, and client construction dies with java.util.ServiceConfigurationError: io.ktor.client.HttpClientEngineContainer: io.ktor.client.engine.cio.CIOEngineContainer not a subtype Since GoogleAnalytics fires from the problem-gathering message bus listener, every gathered batch popped an IDE internal error on those IDEs. Name the bundled Java engine explicitly — HttpClient(Java) — so no service discovery happens at all. Also create the client lazily and wrap the send in runCatching: analytics is best-effort and must never surface an IDE error, whatever else goes wrong.
|
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
Pushpavel
added a commit
that referenced
this pull request
Jul 12, 2026
…wser extension - feat: submit support via companion browser extension (#172) - fix: no longer crowd out native run configurations (#173) - fix: analytics ServiceConfigurationError on 2025.2+ IDEs bundling ktor (#174) - fix: endless loading of Project settings page with no project open (#175) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
On recent IDEs (2025.2+ — observed on RustRover and CLion 2026.1.4) every gathered problem batch pops an IDE internal error from AutoCp:
java.util.ServiceConfigurationError: io.ktor.client.HttpClientEngineContainer: io.ktor.client.engine.cio.CIOEngineContainer not a subtype(full stack trace)Root cause
Those IDE builds ship their own ktor in the platform classpath (
lib/intellij.libraries.ktor.client.cio.jaretc).GoogleAnalyticscreates its client asHttpClient { ... }with no engine named, so ktor falls back to engine auto-discovery viajava.util.ServiceLoader. The plugin classloader's resource lookup also sees the platform'sMETA-INF/services/io.ktor.client.HttpClientEngineContainer, and loading theCIOEngineContainerit names yields a class that implements the platform copy ofHttpClientEngineContainer— not the one from the ktor 2.1.2 the plugin bundles.ServiceLoaderiteration then throwsnot a subtype, client construction fails, and since it happens inside the problem-gathering message-bus listener the exception surfaces as an IDE internal error. Older IDEs don't bundle ktor, which is why this never showed up before.Fix
HttpClient(Java) { ... }(ktor-client-javais already a dependency) — so no service discovery happens at all.runCatching. Analytics is best-effort; whatever else goes wrong in it should never pop an IDE error over the user's workflow.Testing
compileKotlinpasses.HttpClient(Java)takes the explicit-factory constructor path, which never touchesServiceLoader(HttpClientJvm.kt's engine list is only consulted by the no-arg overload), so the failing lookup in the trace above is no longer reachable.