Skip to content
Latchkey

Clojure "Could not locate X on classpath" (deps.edn) in CI

A require asked for a namespace whose file or providing library is not on the classpath built from deps.edn. Clojure reports it cannot locate the .clj/.cljc or compiled __init.class.

What this error means

A run fails with "Execution error ... Could not locate <path>__init.class, <path>.clj or <path>.cljc on classpath" naming the namespace.

clojure
Execution error (FileNotFoundException) at ...
Could not locate cheshire/core__init.class, cheshire/core.clj or
cheshire/core.cljc on classpath.

Common causes

The dependency is not declared in deps.edn

The required namespace lives in a library missing from :deps, so its files are not on the classpath.

A source path is not on the classpath

A local namespace exists but its directory is not in :paths, so the compiler cannot find the file.

How to fix it

Add the dependency to deps.edn

  1. Read which namespace could not be located.
  2. Add the library that provides it to :deps.
  3. Re-run with the right alias so the classpath includes it.
deps.edn
{:deps {cheshire/cheshire {:mvn/version "5.13.0"}}}

Add the source directory to :paths

For a local namespace, ensure its directory is on :paths so the file is on the classpath.

deps.edn
{:paths ["src" "resources"]}

How to prevent it

  • Declare every required library in :deps.
  • Keep :paths covering all source and resource directories.
  • Run the same alias locally and in CI so the classpath matches.

Related guides

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