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
- Identify which dependency defines the task.
- Add it to
depsinmix.exsand runmix deps.get. - Re-run the task so its module is available.
mix.exs
defp deps do
[{:ecto_sql, "~> 3.11"}, {:postgrex, ">= 0.0.0"}]
endRun 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.getbefore tasks that need those deps. - Invoke Mix from the project root in CI.
Related guides
Elixir "(Mix) Could not compile dependency" in CIFix Elixir "** (Mix) Could not compile dependency :X" in CI - a dependency failed to compile, often a missing…
Elixir "mix deps.get ... no matching version" (Hex) in CIFix Elixir "Failed to use X because ... no matching version" during mix deps.get in CI - Hex could not find a…
Elixir "(CompileError) undefined function" in CIFix Elixir "** (CompileError) ... undefined function X/N" in CI - the compiler reached a call to a function w…