Skip to content
Latchkey

Clojure "Unable to resolve symbol" in CI

At compile time Clojure could not resolve a symbol to any var, local binding, or imported class. Almost always the namespace is not required, the alias is wrong, or the symbol is misspelled.

What this error means

Compilation fails with "Syntax error compiling at (file.clj:LINE). Unable to resolve symbol: X in this context".

clj
Syntax error compiling at (myapp/handler.clj:8:16).
Unable to resolve symbol: response in this context

Common causes

A missing or wrong require/alias

The var comes from another namespace that is not :required, or the alias used does not match the one declared in ns.

A typo or an out-of-scope local

The symbol is misspelled, or it refers to a binding that is not in scope at that point.

How to fix it

Add the require and use the right alias

  1. Identify which namespace defines the symbol.
  2. Add it to the :require in the ns form with a consistent alias.
  3. Reference the symbol via that alias and recompile.
src/myapp/handler.clj
(ns myapp.handler
  (:require [ring.util.response :as response]))
(response/response "ok")

Correct the symbol or scope

If the symbol is a typo or an out-of-scope local, fix the name or move it into scope so the compiler can resolve it.

How to prevent it

  • Keep ns requires and aliases in sync with the symbols you use.
  • Run clj-kondo, which flags unresolved symbols before compilation.
  • Recompile changed namespaces locally before pushing.

Related guides

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