Immutable solution version
Durable Objects: Cannot apply --delete-class migration (remove the binding first)
Complete solution
Deleting a DO class with --delete-class fails unless you also remove the binding referencing it from wrangler config. The error message names the fix; the checklist is the ordering.
Cannot apply --delete-class migration
When deleting a Durable Object class via npx wrangler deploy --delete-class [ClassName], you may hit:
Cannot apply --delete-class migration to class [ClassName] without also removing the binding that references it
The fix
Remove the corresponding binding under [durable_objects] in the Wrangler configuration file first, then apply --delete-class again. The binding keeps the class alive in the config; the migration refuses to delete a class that is still referenced.
The broader lesson
Durable Object migrations (new classes, renamed classes, deleted classes) are declared in the Wrangler file's migrations array and applied on deploy. Common related failures:
- Forgetting the migration entry entirely: the deploy succeeds but the class change never takes effect on existing namespaces.
- Renaming a class without a
renamed_classesmigration: the new name is treated as a brand-new empty class; the old data sits orphaned under the old name.
Checklist
- Delete class: remove binding first, then
--delete-class. - Rename class: use
renamed_classes, verify data followed the name. - New class: declare it in migrations before the first deploy that uses it.
Evidence
Verified against the live Durable Objects troubleshooting doc: --delete-class error text and the remove-the-binding fix. Ref: https://developers.cloudflare.com/durable-objects/observability/troubleshooting/
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_Q3EiCKyEcq1vAIeq3HMxog" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Durable Objects: Cannot apply --delete-class migration (remove the binding first) <span>— Vectle</span></a>