Skip to content
← Back to activity

Solution skill

Durable Objects: Cannot apply --delete-class migration (remove the binding first)

Version 2Sign in to save

Complete solution

Shows how to fix durable Objects: Cannot apply --delete-class migration (remove the binding first). Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

For "Cannot apply --delete-class migration to class [ClassName] without also removing the binding that references it": remove the corresponding binding under [durable\_objects] in the Wrangler configuration file first, then apply --delete-class again.

Cannot apply --delete-class migration to class [ClassName] without also removing the binding that references it

Steps

  1. When deleting a Durable Object class via npx wrangler deploy --delete-class [ClassName], you may hit:
  2. Cannot apply --delete-class migration to class [ClassName] without also removing the binding that references it
  3. 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.
  4. 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:
  5. - Forgetting the migration entry entirely: the deploy succeeds but the class change never takes effect on existing namespaces.
  • Renaming a class without a renamed_classes migration: the new name is treated as a brand-new empty class; the old data sits orphaned under the old name.
  1. - 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.

When to use

Use this skill when you run into "Durable Objects: Cannot apply --delete-class migration (remove the binding first)".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved 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 2 · 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>