Stupid question.. I haven't been doing Kotlin for...
# kotlin-toolchain
j
Stupid question.. I haven't been doing Kotlin for over a year.. And this is also the first time I'm using the Kotlin toolchain. I'm migrating one of my older project that I never released to maven central, hoping to making it easier to publish with the toolchain. Though, IntelliJ is showing me some issues: Has anything changed with Kotlin, or have I configured the project incorrectly?
message has been deleted
Tests are passing, but IntelliJ is loading the project right anyways
j
The
kotlin-stdlib
is automatically added to your classpath so you shouldn't have to add it. If the code is red in the IDE but green in the CLI, it's definitely a bug.
j
I'm invalidating caches and restarting
j
One thing that I know was fixed recently (and might not be fixed in your IDEA version) is a bug that happens when you already have a
.idea
folder from a previous state of the project (e.g. if the project was originally in Gradle). I'd suggest to close the project, delete
.idea
and re-open, just to be sure. Also you can try the invalidate and restart, yes
(@utikeev please correct me if I'm wrong here)
j
Invalidating the caches somehow made it worse
Deleting the .idea directory also did not help
😭 1
Oh, even this broken now lol
stdlib is no longer resolved by the IDE now
j
Really sorry to hear that. If there any chance you could share the project so we can try to reproduce?
j
Yep, I'll see about pushing a branch
Just need to sort out my signing keys (recently re-installed my Mac)
j
No problem. And by the way, thank you so much for all the feedback here! It's very valuable. I'm always sad to hear when the onboarding experience is not smooth, but thanks to people like you who take the time to report this stuff, we can address some of the problems at least.
j
I have somehow not saved the passphrase to my signing keys in my password manager πŸ™‚
😡 1
Found it!
yay 1
🍾 1
j
Maybe that's a good thing we could automate (
kotlin tool keygen
that would upload the public key to common key servers as well), but I digress πŸ˜„
πŸ™Œ 1
πŸ˜… 1
(I mean we literally have
kotlin tool generate-keystore
already, but the shape of this command is a bit specific to Android stuff)
j
github.com/jamesbradlee/tools.logfmt/tree/kotlin-toolchain
Copy code
git clone --depth 1 --single-branch --branch kotlin-toolchain git@github.com:jamesbradlee/tools.logfmt.git
Pushed again with the kotlin wrapper binaries
> No problem. And by the way, thank you so much for all the feedback here! It's very valuable. I'm always sad to hear when the onboarding experience is not smooth, but thanks to people like you who take the time to report this stuff, we can address some of the problems at least. When I was actively working with Kotlin projects I was already following this project back when it was still called Amper and waiting for it to be usable in enterprise environments. Pretty psyched to see it has come a lot further since then, with a website and everything. I noticed it again during some kotlin news.
kodee loving 1
j
Thanks for sharing the project
Everything is green for me in the IDE too laugh cry
j
Green as in, imports are ok?
j
Yes
message has been deleted
j
Gotta love non-deterministic/non-reproducible issues Β―\_(ツ)_/Β―
j
IntelliJ is a "beautiful" machine πŸ˜… Powerful, yet full of mysteries
j
Ssshh you can't say that here! Friendly fire!
oops 1
j
Don't get me wrong, I would trade this IDE for nothing else πŸ˜„ But I have to acknowledge the quirks
❀️ 1
j
message has been deleted
What JDK are you using? Maybe it's something wrong with how I've set it up?
message has been deleted
j
I actually have no project-level JDK πŸ™‚ Technially, the Kotlin Toolchain provisions JDKs at the module level, so there is no need for project JDK, but often IntelliJ complains about this because it was not really built for this situation, so it's probably for the best that you have a project-level JDK.
Ok one thing that might help my colleague investigate. Do you by any chance have this
Dump Workspace Entities to a File as Json
action? (I'm not sure whether it's an internal thing or not)
j
message has been deleted
j
And no other variant with the
Dump Workspace Entities
prefix I presume? Then maybe it's just an internal tool, sorry to have bothered you with this!
j
message has been deleted
Copy code
❯ ./kotlin --version
Kotlin Toolchain version 0.12.0 (2039c53, 2026-08-25)
Kotlin Toolchain plugin: 262.10315.125
j
Thanks, yeah I have all the same versions
j
Is there a log file for IntelliJ / the plugin anywhere?
message has been deleted
j
There is a log file for IntelliJ as a whole, yes:
I really think it's due some dangling state. It must either be in
.idea
(but you said you tried deleting it), or it might be in the IntelliJ's system directory. Maybe you can try deleting your project's folder there:
<systemDir>/projects/tools.logfmt.<someHash>
j
I'm gonna just make a .bak of that one before I touch
πŸ‘πŸΌ 1
Still no 😞
Building it still works though..
j
Yeah it might just be the Kotlin plugin getting messed up dependencies for analysis of the files, but I'm just making random guesses now. If you go to the Project Structure like you did in your screenshot above, what do you get for the
logfmt.main
module in the Dependencies tab? (in your screenshot, you were on the Kotlin node)
j
message has been deleted
😱 1
j
Well, now _that_'s interesting
so it somehow figured out your backup of the dir πŸ˜‚ Maybe you can move it out of there?
j
Oh... I invalidated caches again
Now it works
Why it didn't work the first time I don't know
No nevermind
FUCK
j
Wow, nice!
Yeah I would be super eager to know the steps that led to the broken state
j
message has been deleted
Yeah I would be super eager to know the steps that led to the broken state
This is a fresh install from today 😒
I installed it via toolbox
j
But you did open your project as a Gradle project, first, right?
j
message has been deleted
No, the first time I actually just created the project.yaml and module.yaml files manually before I even cloned the repo, just to test
j
The red folders in the Sources tab are normal I believe. These are directories that are registered in case you add files there, so they will be picked up. I also have them red, but the rest of the code is fine
Ok so, last thing, can you close the project, delete
.idea
, and move your
.bak
folder out of your IntelliJ system dir, and delete whatever other directory with your project name might have been created there?
j
Can I delete the whole dir? πŸ€”
message has been deleted
j
I see no IntelliJ there, deleted already?
j
Wait.. Hold on..
/Users/t980781/Library/Caches/JetBrains
Do you think this is safe to delete?
I deleted it πŸ™‚
nuke 1
Deleted .idea and the entire caches for jetbrains
Still doesn't work
Is this meant to have no classpath?
j
Well you deleted the
Library/Caches/JetBrains/Kotlin
too I suppose πŸ˜„ Which contains the provisioned JDK, but the Kotlin Toolchain should re-provision it if you do
kotlin build
Or even just sync the project
j
Still empty
j
Might be worth deleting this entry (in the SDKs table), and re-syncing the project
j
Which sync action?
j
Sync Kotlin project
j
Found out, it has classpath now, but still no work
j
Ok good (for the classpath), and bad for the red code
I'm sorry I'm out of ideas. Maybe on Monday my all-knowing IDE-specifialist of a colleague @utikeev will be able to figure this out, or suggest more stuff, but in the meantime I'm at a loss
πŸ‘ 1
I would normally say just nuke all your caches and data folders, but that apparently didn't work
Ah actually there is more data cached for intellij
In this Special files and folders view there is also a Config dir (not system):
I'm not super familiar with all this, but the
<configDir>/workspace
directory seems to contain some data as well
The problem is that it's hard to pinpoint stuff that you want to remove. I don't know if this contains important config for you
(you can probably tell I don't know much about the IDE side of things πŸ˜… )
j
Haha I don't blame you!
message has been deleted
IntelliJ is resolving dependencies now
Nope, still does not work
In fact, now it doesn't even recognize built-ins anymore, what
I'm just going to try uninstalling everything and re-install.
@joffrey It works now πŸ™‚
j
Oh great to hear!
Sorry that you had to go through this trouble, but at least you have a working environment now
j
No problem! Thanks for all the help! I really can't say what caused it not to work in the first place..
You know what? Could it be that my internet dropped out at a critical moment, and something that should have been installed didn't get installed?
I've had some hiccups with my internet today...
j
On the IDE side I really don't know. On the CLI side, I guess we know it wasn't affected since it could build/test fine
j
Yea
j
And for such a simple JVM project there is almost nothing to provision besides the JDK and the Kotlin compiler
j
Also, I don't know if its too late - but it would be VERY nice if the kotlin wrapper binary could be renamed to kotinw, because in IntelliJ there's no way to hide the kotlin wrapper binary, without also hiding any directory named kotlin (i.e. in projects that still uses Gradle).
Or at least kotlin.sh
I may have to bite the sour apple and use the kotlin wrapper, but at least I'd like to hide it from the file explorer πŸ™‚
j
Wow I have never used this IDEA feature πŸ˜… I actually dislike anything that hides files, because I want to see everything πŸ˜„ But I get the point. I don't know if the name's going to change. One possible hope is that one day we might use a single file as a wrapper, and if we want to do that it's likely to have the name
kotlin.cmd
because
cmd.exe
on Windows can only run scripts named
.bat
or
.cmd
🀷🏼 Or we might decide to go full powershell on Windows. Anyway, this is just random thoughts at the moment
πŸ‘ 1
j
It's broken again... I checked out the main branch, which is a gradle project still, then back to the kotlin-toolchain branch, and now it's broken
j
Ok so it does seem due to Gradle's latent state when trying to open as Kotlin Toolchain project
Then it might very much be what my colleague is already aware of and trying to fix. But I'm surprised deleting
.idea
didn't solve the problem. I thought it did last time I checked
j
Yeah.. No it still doesn't work to delete the .idea directory
😒 1
k
So, does it reproduce only for a Gradle project that was converted to Kotlin Toolchain? Or a newly created project is affected as well?
j
I'll try creating an entirely new project to see what happens, hold on though. I'm testing something else atm
πŸ™ 1
Apart from logs, these are the only JetBrains related files related to the tools.logfmt project.
Deleting project related files did not solve anything.
So, creating a new project with spring boot seems to work
good 1
However.... The standard library no longer works, not even on the new spring boot project
🀯 1
k
Which version of IntelliJ IDEA and which version of the Kotlin Toolchain plugin do you use?
j
Copy code
Kotlin Toolchain version 0.12.0 (2039c53, 2026-08-25)
IntelliJ IDEA 2026.2.2 Build #IU-262.10315.125, built on September 2, 2026 Source revision: 947f011dc3107 Licensed to Telenor Norge AS / James Bradlee Subscription is active until March 8, 2027. Runtime version: 25.0.4+1-b508.27 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Toolkit: sun.lwawt.macosx.LWCToolkit macOS 26.6.2 Exception reporter ID: 0409262823efdad-9c42-4e67-b599-2a058129ca06 JCEF version: 144.0.15-262-b37 GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation Memory: 2048MiB Cores: 10 Metal Rendering is ON Registry: ide.experimental.ui=true idea.ignore.disabled.plugins=true trace.state.event.service.url=api.jetbrains.cloud/trace-status Non-Bundled Plugins: org.jetbrains.plugins.node-remote-interpreter (262.10315.135) com.dprint.intellij.plugin (0.9.1) com.nbadal.ktlint (0.30.5) com.intellij.javaee (262.10315.131) DuplicateLines (1.1.0) org.jetbrains.kotlin-toolchain (262.10315.125) Kotlin: 262.10315.125-IJ
πŸ‘ 1
org.jetbrains.plugins.node-remote-interpreter (262.10315.135) com.intellij.javaee (262.10315.131) So I did not install these?
k
Could you please share the idea.log file? (sorry if you already did: the thread got really big =)) )
j
Yep, hold on
k
So I did not install these?
They are not bundled, so I guess you did install them at some point. Maybe somewhen in the past. If you don’t need them, of course, feel free to disable/uninstall.
j
Hmm... No... They were pretty much there when I re-installed IntelliJ.. edit: they were also there the first time I installed IntelliJ, for that matter. activating enterprise license maybe?
πŸ€” 1
message has been deleted
πŸ™ 1
k
Let’s try to disable them anyway, at least temporarily, just as a check, because the issue you’re experiencing is really strange, so it’s better to exclude all possible cases.
j
Yep
Or maybe not?
dprint I did install
Only the other two I did not
k
Yeah, anyway, let’s try to disable all of the custom plugins, except Kotlin Toolchain, and see what happens. I have some doubts about Ktlint suspicious
j
Nope, still doesn't work
okay 1
πŸ™ 1
So I disabled most of the plugins now, including bundled, I'll re-check
Yep, nope.. that did nothing
Let me do another re-install and run a diff on everything..
They are indeed bundled
πŸ‘ 1
I managed to click the wrong icon and stop the recording, anyway... this is after the re-install. I'm going to run a diff and compare the two idea.bak and idea2.bak
k
So, after the reinstallation everything started to work? The code seems to be green now?
j
Yes, after the re-install, everything works.
🀯 1
sweating towel guy 1
nice real 1
I have some findings in the diff, but I'm not done yet
I cannot for some reason reproduce it anymore either... what
Even with my extensions
Something killed it again now... WHAT
AH MY GHAD
I found the issue!
Settings -> Editor -> File Types -> Ignored Files and Folders I had added kotlin and kotlin.bat to the ignored files, because I don't want to see them in my file explorer.
😱 1
Please fix this πŸ™
j
But are you sure this feature is only cosmetic? This might be to tell intellij to ignore those files in all respects, but those are mandatory right now
this 1
> controls which files the IDE's Virtual File System completely skips, hiding them from project views, code completion, and search results So you're not hiding it for you, you're hiding it from the IDE's file system. We can't read this file if you do this, and as I mentioned earlier, the wrapper files are required right now for IDE support. I think what we could improve is to properly notify when the wrappers are not found (short term), and longer term, maybe make it possible to use the global installation instead of the wrapper (if the version is moved to
project.yaml
), but in the meantime maybe you can just live with them in your root?
πŸ™Œ 1
u
Wow, that's indeed quite an unexpected aftermath of the understandable desire to hide the wrappers πŸ˜„ I'm sorry that you have to go through so many troubles! As @joffrey rightfully mentioned, for now the wrappers are required for the proper support in the IDE being the only reasonable source of truth about the project version. We do have an issue about lifting up this restriction and making wrappers truly optional: KTC-5156. This would also allow us to fallback to the global installation in the IDE more reliably than we can now (that's the reason it's not supported yet). The code insight turned red because Kotlin standard library symbols have
kotlin
directory on its path (inside the JAR), so IntelliJ ignored everything under that πŸ™‚ NB: the sync still discovers and launches the wrappers, even if they are excluded, because it doesn't access them through the VFS but just uses NIO as no IntelliJ features are required to operate with the wrappers. If the wrappers are missing on disk, we should produce better error messages and fixes, though, and maybe some explanation/links on why wrappers are needed.