cider icon indicating copy to clipboard operation
cider copied to clipboard

Error running cider in Guix

Open mgadhvi opened this issue 1 month ago • 4 comments

Expected behavior

Cider should be able to create a Nrepl session and connect to it

Actual behavior

Cider throws this error when using cider-jack-in outside of a clojure project

Are you sure you want to run `cider-jack-in' without a Clojure project? (y or n) y
[nREPL] Starting server via /home/mgd/.guix-profile/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.3.1\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.57.0\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[cider.nrepl/cider-middleware\]\"\]\}\}\} -M:cider/nrepl
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (REPL:-1).
com.sun.source.doctree.BlockTagTree

And this error when in a clojure project

[nREPL] Starting server via /home/mgd/.guix-profile/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"1.3.1\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.57.0\"\] -- repl :headless :host localhost
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Error loading cider.nrepl: Syntax error macroexpanding at (orchard/java/parser_next.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Error loading cider.nrepl: Syntax error compiling at (orchard/info.clj:1:1).
Syntax error compiling var at (/tmp/form-init15412552975819076293.clj:1:9927).
Unable to resolve var: cider.nrepl/wrap-apropos in this context

Steps to reproduce the problem

  1. install the following
$ guix install clojure leiningen openjdk emacs-cider
  1. Create a new project using leiningen
$ lein new app my-stuff
  1. Open my-stuff/src/my_stuff/core.clj
  2. Run the command cider-jack-in

Environment & Version information

CIDER version information

I am unable to start cider repl. The output for cider-version is CIDER 1.19.0 (Skiathos)

I am able to run lein repl and connect to it using cider-connect. This give the following:

;; Connected to nREPL server - nrepl://localhost:36329
;; CIDER 1.19.0 (Skiathos), nREPL 1.3.0
;; Clojure 1.12.2, Java 24.0.1

Lein / Clojure CLI version

  • Leiningen 2.12.0 on Java 24.0.1 OpenJDK 64-Bit Server VM
  • Clojure CLI version 1.11.1.1413

Emacs version

GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.49, cairo version 1.18.4)

Operating system

guix (GNU Guix) 19fdda038f5051c038a3f3e52dcc27be3923a3aa

JDK distribution

openjdk 24.0.1 2025-04-15

mgadhvi avatar Nov 17 '25 21:11 mgadhvi

We had such problem before, usually this is caused by some broken JDKs or not JDKs at all (like JRE). However, I think it still used to work JRE, so it's a bug that resurfaced. Is it possible for you to download and run a JDK not installed via guix?

alexander-yakushev avatar Nov 17 '25 21:11 alexander-yakushev

I’ll have a look but I don’t have much experience packaging in Guix. Does Cider rely on a particular version of Java?

mgadhvi avatar Nov 18 '25 08:11 mgadhvi

I've managed to fix it by running the following two commands

Guix: guix package -i openjdk:jdk Emacs: (setq cider-download-java-sources t)

mgadhvi avatar Nov 18 '25 21:11 mgadhvi

However, I think it still used to work JRE, so it's a bug that resurfaced.

@alexander-yakushev I think the parser logic depends on some JDK classes, but my memories on the subject are fuzzy.

bbatsov avatar Nov 19 '25 06:11 bbatsov