rake aborted! Don't know how to build task Ruby / Rails Origin: Application & API OSI layer 7 · Application Last updated 5 Nov 2026

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

Rake doesn't know the task name — a typo, a missing Rakefile, or a gem/engine not loaded.

Exact message you may see rake aborted! Don't know how to build task 'db:migrat'Don't know how to build task 'assets:precompile'rake aborted! Don't know how to build taskSee the list of available tasks with `rake --tasks`Rake::Task Don't know how to build task
Seen on: Ruby

Meaning

List tasks (bin/rails -T / rake -T), check spelling and the environment (some tasks exist only in certain envs), run via bin/rails (Rails 5+) so the app loads, and make sure you're in the project directory containing the Rakefile.

Common causes

  • Typo in task name
  • Rakefile missing in the current directory
  • Gem providing the task not in the Gemfile/group
  • Task only defined for another environment
  • Running rake outside bundle exec

⚡ Quick fix

  1. bin/rails -T | grep migrate
  2. cd into the project and use bundle exec rake
  3. Add the gem to the correct Gemfile group

Detailed fix by platform

Rails

  1. bin/rails -T | grep -i db:

How to diagnose

  1. Name — Spelling?
  2. Directory — Has Rakefile?
  3. Gem — Loaded in this env?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

ArgumentError: missing keyword / unknown keyword — Ruby: ArgumentError: missing keyword: :name / unknown keyword: :nmae (Ruby / Rails)ArgumentError: missin…ArgumentError: wrong number of arguments (given 1, expected 2) — Ruby: ArgumentError: wrong number of arguments (given 1, expected 2..3) (Ruby / Rails)ArgumentError: wrong …Bundler could not find compatible versions for gem — Bundler: Bundler could not find compatible versions for gem "activesupport": In Gemfile: rails (= 7.1.0) depends on activesupport (= 7.1.0) (Ruby / Rails)Bundler could not fin…Bundler: Could not find gem in locally installed gems — Bundler: Could not find gem 'rails (~> 7.1)' in locally installed gems / Could not find rails-7.1.0 in any of the gem sources listed in your Gemfile (Ruby / Rails)Bundler: Could not fi…FactoryBot::DuplicateDefinitionError: Factory already registered — FactoryBot: FactoryBot::DuplicateDefinitionError: Factory already registered: user (Ruby / Rails)FactoryBot::Duplicate…LoadError: cannot load such file — Ruby: LoadError: cannot load such file -- nokogiri (or: cannot load such file -- bundler/setup) (Ruby / Rails)LoadError: cannot loa…RSpec::Expectations::ExpectationNotMetError: expected X got Y — RSpec: expected: 200 got: 404 (compared using ==) — RSpec::Expectations::ExpectationNotMetError (Ruby / Rails)RSpec::Expectations::…rake abor…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.