Skip to content
Latchkey

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.

lein
Error loading project.clj: Failed to read project.clj:
java.lang.RuntimeException: Unmatched delimiter: )
Caused by clojure.lang.LispReader$ReaderException

Common 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

  1. Read the reader exception; it names the delimiter or form at fault.
  2. Fix the unbalanced delimiter or malformed value in project.clj.
  3. Run lein deps locally to confirm the file now reads.
project.clj
(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.

Terminal
lein with-profile -user deps

How to prevent it

  • Keep project.clj under an editor with paren matching or a linter.
  • Run lein deps locally before pushing changes to the project file.
  • Avoid referencing undefined vars inside the project map.

Frequently asked questions

What causes ""Error reading project.clj""?
An unbalanced parenthesis, bracket, or string quote makes the Clojure reader fail before the project map is built.
How do I fix "Error reading project.clj"?
Balance and validate the project form

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card