Skip to content
Latchkey

Elixir "(Mix) The task X could not be found" in CI

Mix looked for the named task and found no module providing it. Either the dependency that defines the task is not installed, or the task name is misspelled.

What this error means

A step like mix phx.server or mix ecto.create fails immediately with "** (Mix) The task \"X\" could not be found", sometimes with a "Did you mean?" hint.

elixir
** (Mix) The task "ecto.create" could not be found
Note no mix.exs was found in the current directory or ...

Common causes

The dependency providing the task is missing

Tasks like ecto.create come from a dependency (ecto_sql) that is not declared or not fetched, so Mix has no module for it.

The task name is wrong or run outside the project

A misspelled task, or running Mix where no mix.exs exists, leaves Mix with no matching task.

How to fix it

Add and fetch the providing dependency

  1. Identify which dependency defines the task.
  2. Add it to deps in mix.exs and run mix deps.get.
  3. Re-run the task so its module is available.
mix.exs
defp deps do
  [{:ecto_sql, "~> 3.11"}, {:postgrex, ">= 0.0.0"}]
end

Run from the project root with the right name

Ensure the step runs where mix.exs lives and uses the exact task name (check the "Did you mean?" hint).

How to prevent it

  • Declare every dependency whose Mix tasks you invoke.
  • Run mix deps.get before tasks that need those deps.
  • Invoke Mix from the project root in CI.

Related guides

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