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

**Code:** `rake aborted! Don't know how to build task` · **Category:** Ruby / Rails · **Seen on:** Ruby

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

## 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?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ruby/rake-dont-know-how-to-build-task)
