Clojure "Syntax error compiling" / "Error loading namespace" in CI
The Clojure compiler failed while compiling a form or loading a namespace. The message names the file, line, and column, and a "Caused by" gives the underlying reason (a bad form, a missing require, or an unresolved symbol).
What this error means
A build or test run fails with "Syntax error compiling at (file.clj:LINE:COL)" or "Error loading namespace", and the compilation stops at that form.
Syntax error compiling at (myapp/core.clj:12:3).
Unable to resolve symbol: foo in this context
Error loading myapp.coreCommon causes
A malformed form or bad macro usage
An unbalanced form, a misplaced special form, or wrong macro arguments makes the compiler reject the code at that line.
A namespace that fails to load its requires
A :require that cannot be resolved throws while loading the namespace, surfacing as "Error loading namespace".
How to fix it
Fix the form at the reported location
- Open the file at the line and column in the message.
- Correct the malformed form or the wrong macro/arity usage.
- Re-run the compile or test to confirm the namespace loads.
clojure -M -e "(require 'myapp.core)"Resolve failing requires first
If the "Caused by" points at a require, fix that namespace or its dependency so the load chain succeeds.
How to prevent it
- Run a compile or
requirecheck locally before pushing. - Keep requires accurate as namespaces are renamed or moved.
- Use a linter to catch bad forms before the compiler does.