Skip to content
Latchkey

Ruby "Don't know how to build task" - rake Task Not Found in CI

rake could not find the task you asked it to run. The Rakefile loaded, but no task by that name is defined - a typo, a namespace not required, or a gem-provided task missing because rake ran outside the bundle.

What this error means

rake <task> aborts with "Don’t know how to build task '<task>'" and suggests rake --tasks. The Rakefile itself loaded fine; the specific task simply is not defined in this context.

rake output
rake aborted!
Don't know how to build task 'db:seed' (See the list of available tasks with `rake --tasks`)

Common causes

Misspelled or wrong-namespace task

The task name or its namespace is wrong (db:seed vs db:seeds), so rake has no matching definition. rake --tasks shows the real names.

A gem/engine task was not loaded

Tasks defined by a gem (or a Rails engine) only exist if that gem is in the bundle and its rake tasks are required. Running rake outside the bundle, or with the gem excluded, hides those tasks.

How to fix it

List the available tasks and run the right one

Terminal
bundle exec rake --tasks
bundle exec rake db:seed

Ensure the defining gem is in the bundle

  1. Run rake through bundle exec so gem-provided tasks are loaded.
  2. Confirm the gem that defines the task is in the Gemfile and not in an excluded group.
  3. For Rails, make sure the environment that registers the task is loaded.

How to prevent it

  • Run rake via bundle exec so all gem tasks are available.
  • Keep task names consistent and reference them exactly.
  • Do not exclude groups whose gems define rake tasks the job runs.

Related guides

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