Skip to content
Latchkey

opam "not found in ... repositories" in CI

opam looked through the repositories attached to the current switch and found no package by that name. Either the name is wrong, the repo is stale, or the package is only available from a repo you have not added.

What this error means

opam install fails with "[ERROR] No package named X found" or "Package X not found in the repositories of the current switch" even though the package exists on the opam registry.

opam
[ERROR] No package named lwt_ppx found. Perhaps you meant one of these?
    lwt
    lwt_react
[ERROR] Package lwt_ppx not found in the repositories of the current switch.

Common causes

A stale opam repository in the CI switch

The runner cached an old repo snapshot that predates the package release, so opam install cannot see it.

A missing or misspelled repository/package name

The package lives in a repo the switch never added, or the name differs from the import/findlib name.

How to fix it

Refresh the repositories

  1. Run opam update to pull the latest package index.
  2. Confirm the exact package name against the opam registry.
  3. Re-run the install once the index is current.
Terminal
opam update
opam install lwt_ppx --yes

Add the repository that hosts it

If the package is not on the default repo, add its source explicitly before installing.

Terminal
opam repo add my-repo https://example.com/opam-repo
opam update

How to prevent it

  • Run opam update early in CI so the package index is fresh.
  • Pin repository sources you depend on so they are always attached.
  • Verify package names against the registry, not the import name.

Related guides

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