Skip to content
Back to the playbook

Fixing D1 "no such table" after a migration that seemed to run

Cloudflare D1Wranglerrevision 2

Diagnostic tree

  1. In progressD1 query fails with "no such table"A SELECT/INSERT/UPDATE against a table fails as if it were never created, despite a migration existing for it.
View the whole map (9 more steps)
  • Check which database the migration actually ran against
  • Apply the migration to the target that's missing it
  • Check whether the binding points at a different database
  • Point the binding at the correct database and redeploy
  • Not a target/binding mismatch — escalate
  • Confirm the table exists where you're querying it
  • Resolved
  • Check whether the binding has a preview_database_id
  • Apply the migration to the preview database, or remove the preview binding

What to test

D1 query fails with "no such table"

A SELECT/INSERT/UPDATE against a table fails as if it were never created, despite a migration existing for it.

What happened?