clj-kondo

cjohansen 2025-09-15T09:50:48.860759Z

We have a strange problem where clj-kondo keeps warning us that medley.core/greatest-by and medley.core/least-by don't exist. Details in ๐Ÿงต

โœ… 1
cjohansen 2025-09-15T09:51:49.055549Z

Here's an example:

clj-kondo --lint src/matnyttig/import/tilsynsloop.clj
src/matnyttig/import/tilsynsloop.clj:4:14: warning: namespace cljc.java-time.local-date-time is required but never used
src/matnyttig/import/tilsynsloop.clj:10:34: error: Unresolved var: greatest-by
src/matnyttig/import/tilsynsloop.clj:10:46: error: Unresolved var: least-by
linting took 49ms, errors: 2, warnings: 1
See namespace form in screenshot

cjohansen 2025-09-15T09:52:03.511709Z

The red line is lsp complaining about the same thing via kondo

borkdude 2025-09-15T09:52:03.870159Z

are you using :refer-all maybe?

cjohansen 2025-09-15T09:52:14.217329Z

No, just refer, see screenshot

cjohansen 2025-09-15T09:53:16.375559Z

clj-kondo --lint src/matnyttig/import/tilsynsloop.clj
src/matnyttig/import/tilsynsloop.clj:125:25: error: Unresolved var: medley.core/least-by
src/matnyttig/import/tilsynsloop.clj:664:36: error: Unresolved var: medley.core/greatest-by
linting took 87ms, errors: 2, warnings: 0
It complains even without the refer

borkdude 2025-09-15T09:53:18.642589Z

ah ok. can you see if there is a cache file in

.clj-kondo/.cache/v1/cljc/medley.core.transit.json or so?

borkdude 2025-09-15T09:53:24.883649Z

and then send it here?

cjohansen 2025-09-15T09:53:47.521129Z

Will do. I cleaned out .clj-kondo to verify that this problem persisted btw - it did.

borkdude 2025-09-15T09:54:45.239759Z

do you perhaps have another version of medley on the classpath accidentally? medley changed organizations which is a likely cause of having the same library on the classpath twice.

dev.weavejester/medley 

borkdude 2025-09-15T09:55:03.891639Z

it used to be medley/medley I think

borkdude 2025-09-15T09:55:41.122699Z

so print your deps tree and see if there's another medley in there

cjohansen 2025-09-15T09:55:42.424499Z

cjohansen 2025-09-15T09:56:26.873199Z

Yes, I also suspected multiple medley's on the classpath ๐Ÿ˜„

cjohansen 2025-09-15T09:56:32.614759Z

But there was only one

cjohansen 2025-09-15T09:56:43.408449Z

clojure -X:deps tree | grep medley
dev.weavejester/medley 1.9.0

borkdude 2025-09-15T09:57:04.815589Z

is this the same classpath that clojure-lsp uses? it might combine multiple from shadow-cljs etc too

cjohansen 2025-09-15T09:57:14.873039Z

Hmm, good question

cjohansen 2025-09-15T09:57:35.858879Z

I verified the problem without lsp though - using clj-kondo on the CLI. Not sure what deps it is using?

borkdude 2025-09-15T09:57:41.760949Z

I'm pretty sure this is the issue. I'll bet you a beer on it next time we meet on a conference ;)

cjohansen 2025-09-15T09:58:04.800029Z

I don't mind receiving a beer ๐Ÿ˜„

๐Ÿ˜‚ 1
borkdude 2025-09-15T09:58:15.215239Z

it doesn't use any deps unless you tell it to lint a classpath. if you just wipe the .clj-kondo/.cache then it won't complain about this

borkdude 2025-09-15T09:59:09.049619Z

so try to find out which classpath clojure-lsp uses

cjohansen 2025-09-15T09:59:21.174029Z

Yes, verified that the warning goes away without the .cache dir

cjohansen 2025-09-15T09:59:37.880459Z

Any hints on how to find out what classpath lsp uses? ๐Ÿ˜…

borkdude 2025-09-15T10:00:13.725649Z

I'm trying to figure out that myself :)

borkdude 2025-09-15T10:00:20.057339Z

does it have a command line option for this?

cjohansen 2025-09-15T10:01:04.608049Z

I don't really know anything about it, @magnars just made sure it works in my Emacs ๐Ÿ˜„

borkdude 2025-09-15T10:01:29.121739Z

ah lsp-clojure-server-info-raw in emacs

borkdude 2025-09-15T10:01:39.909759Z

this will print the classpath in some buffer

borkdude 2025-09-15T10:01:50.175059Z

in *Messages*

cjohansen 2025-09-15T10:02:11.287719Z

hah, look at that

cjohansen 2025-09-15T10:03:33.366299Z

A wild Medley 1.4.0 appears

borkdude 2025-09-15T10:03:38.826119Z

๐Ÿป

cjohansen 2025-09-15T10:03:50.524339Z

๐Ÿ˜„

cjohansen 2025-09-15T10:04:11.696059Z

FWIW, I said the same thing to @magnars earlier: "There has to be two medleys on the classpath"

2025-09-15T10:04:16.094309Z

This reminds of how nrepl-refactor uses https://github.com/benedekfazekas/mranderson to isolate dependencies via name munging.

cjohansen 2025-09-15T10:04:39.068519Z

What this output isn't telling me is where it's coming from

borkdude 2025-09-15T10:05:12.915069Z

do you have a bb.edn with medley in it? or perhaps shadow-cljs? maybe in an alias in deps.edn?

borkdude 2025-09-15T10:05:15.515209Z

transitively

borkdude 2025-09-15T10:05:36.810269Z

or project.clj

borkdude 2025-09-15T10:05:46.468159Z

clojure-lsp just combines anything it can find ;)

cjohansen 2025-09-15T10:06:34.742799Z

Yeah, I just realized I ran -X:deps without any of the aliases. I just don't know how to do it ๐Ÿ™ˆ

borkdude 2025-09-15T10:06:49.586309Z

do you use any aliases with shadow-cljs or clojure-lsp itself?

borkdude 2025-09-15T10:07:00.640069Z

:aliases '[:foo :bar]' as arguments I think

cjohansen 2025-09-15T10:07:21.221739Z

shadow-cljs, yes

borkdude 2025-09-15T10:07:30.506419Z

want to bet another beer? ;)

๐Ÿ˜‚ 2
cjohansen 2025-09-15T10:09:10.472759Z

Well, well, well, if it isn't the consequences of my own actions lolcry

cjohansen 2025-09-15T10:09:48.361769Z

The culprit was ๐Ÿฅ Compojure

borkdude 2025-09-15T10:10:04.188509Z

also a weavejester production!

cjohansen 2025-09-15T10:10:08.936989Z

Which also has @weavejester's name on it ๐Ÿ˜„

cjohansen 2025-09-15T10:10:11.679279Z

Haha, exactly!

cjohansen 2025-09-15T10:10:50.208529Z

I'll make a PR

cjohansen 2025-09-15T10:11:06.247359Z

Thanks for helping us track this down, it's been a minor annoyance for some time ๐Ÿ˜…

borkdude 2025-09-15T10:11:13.051259Z

nice! no problem

borkdude 2025-09-15T10:11:15.682149Z

๐Ÿป

cjohansen 2025-09-15T10:15:55.968489Z

https://github.com/weavejester/compojure/pull/222

borkdude 2025-09-15T10:16:35.520419Z

๐Ÿ‘

weavejester 2025-09-15T14:48:18.870069Z

Apologies for the issue @christian767. I've just released Compojure 1.7.2 that should fix it.

๐Ÿ™ 2
borkdude 2025-09-15T14:56:06.334179Z

that reminds me, maybe clj-kondo should just warn about this by looking at your deps.edn or project.clj and warn that a library got an org change? not sure if that would really would have detected this issue though

cjohansen 2025-09-15T15:12:14.920549Z

Awesome, thanks @weavejester ! Wasn't a big problem, I'm just glad this long running low key mystery has a conclusion ๐Ÿ˜„