Skip to content
Latchkey

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.

clj
Syntax error compiling at (myapp/core.clj:12:3).
Unable to resolve symbol: foo in this context
Error loading myapp.core

Common 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

  1. Open the file at the line and column in the message.
  2. Correct the malformed form or the wrong macro/arity usage.
  3. Re-run the compile or test to confirm the namespace loads.
Terminal
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 require check locally before pushing.
  • Keep requires accurate as namespaces are renamed or moved.
  • Use a linter to catch bad forms before the compiler does.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →