Durable Object migrations in wrangler.toml

I’m running into an issue where Durable Object migration tags are somehow being removed from script metadata on subsequent deploys, resulting in wrangler publish to fail with workers.api.error.durable_object_namespace_name_taken [API code: 10065].

I posted in the Cloudflare Developers Discord community, in the #durable-objects channel: Discord

I keep getting workers.api.error.durable_object_namespace_name_taken [API code: 10065] when running wrangler publish. From what I’ve been able to discover by looking at Tagged Durable Objects Migrations by xortive · Pull Request #1992 · cloudflare/wrangler · GitHub, the migration tag is somehow getting removed from my script between deploys. I can see it no longer has a migration_tag property by looking at the /v4/accounts/{account_id}/workers/scripts response.

Part of the response from that /v4/accounts/{account_id}/workers/scripts request:

   [
    {
      "id": "color-size-management-api",
      "etag": "d2d1e394829ecfd95f2223b9e47073e326a5e8a85d2bbab2c9749ed2f364551d",
      "handlers": [
        "fetch"
      ],
      "modified_on": "2021-11-24T14:05:31.07674Z",
      "created_on": "2021-10-26T23:22:21.394732Z",
      "usage_model": "unbound",
      "compatibility_date": "2021-11-23",
      "routes": null
    },
    {
      "id": "color-size-management-api-dev",
      "etag": "d7bccebcbbc43f68e3cc7ef3826df16fdfc1f367ef7c81952b19d68dda59d168",
      "handlers": [
        "fetch"
      ],
      "modified_on": "2021-11-21T16:16:26.955566Z",
      "created_on": "2021-11-01T13:38:47.34798Z",
      "migration_tag": "v1",
      "usage_model": "unbound",
      "routes": null
    }
  ]

Notice the "migration_tag": "v1" on the entry with "id": "color-size-management-api-dev", and that the "migration_tag" property is missing entirely on the entry with “id”: “color-size-management-api”. It should should have had "migration_tag": "v2" at the time of this request. In fact, it did have that property after publishing the script with the migration. The next production deploy was successful as well, but the following failed.

I had to delete the Durable Objects after I got workers.api.error.durable_object_namespace_name_taken [API code: 10065], which allowed the next wrangler publish to succeed. But it appears the pattern repeated: The first wrangler publish after the migrations were published was successful, but the following one failed again with workers.api.error.durable_object_namespace_name_taken [API code: 10065].

The bindings and migrations in wrangler.toml, for reference:

[durable_objects]
bindings = [
  { name = "COLOR_FAMILIES", class_name = "ColorFamilies" },
  { name = "COLOR_SWATCHES", class_name = "ColorSwatches" },
  { name = "SIZE_FAMILIES", class_name = "SizeFamilies" },
  { name = "SIZES", class_name = "Sizes" },
  { name = "HEX_CODES", class_name = "HexCodes" },
]

[[migrations]]
tag = "v1" # Should be unique for each entry
new_classes = ["ColorFamilies", "ColorSwatches"]

[[migrations]]
tag = "v2" # Should be unique for each entry
new_classes = ["SizeFamilies", "Sizes", "HexCodes"]

I tried wrangler publish with the migration tables commented out, and it ran successfully. However, the script metadata still does not have a "migration_tag" property.

Is this the intended functionality? If so, what am I missing?