Leiningen "Error reading project.clj" / "Failed to read" in CI
Leiningen reads and evaluates project.clj as Clojure before running any task. A malformed form, an unbalanced paren, or an unresolved symbol in that file stops Leiningen before it can build anything.
What this error means
Any lein command fails immediately with "Error reading project.clj" or "Failed to read" plus a reader or evaluation exception pointing into the project file.
Error loading project.clj: Failed to read project.clj:
java.lang.RuntimeException: Unmatched delimiter: )
Caused by clojure.lang.LispReader$ReaderExceptionCommon causes
A syntax error in project.clj
An unbalanced parenthesis, bracket, or string quote makes the Clojure reader fail before the project map is built.
An unresolved symbol or bad form in the project map
A keyword typo, an undefined var referenced in :profiles, or a broken plugin form throws during evaluation of project.clj.
How to fix it
Balance and validate the project form
- Read the reader exception; it names the delimiter or form at fault.
- Fix the unbalanced delimiter or malformed value in
project.clj. - Run
lein depslocally to confirm the file now reads.
(defproject myapp "0.1.0"
:dependencies [[org.clojure/clojure "1.11.1"]]
:main myapp.core)Isolate a bad profile or plugin
If evaluation fails inside a profile or plugin form, comment it out to confirm the source, then correct that entry.
lein with-profile -user depsHow to prevent it
- Keep
project.cljunder an editor with paren matching or a linter. - Run
lein depslocally before pushing changes to the project file. - Avoid referencing undefined vars inside the project map.