Fields no longer deletable: "itemDuplicationPaths is not iterable"

Hey there!

I cloned my Directus instance today to do some larger refactoring of my data structures.

However, I’ve noticed that I’m no longer able to delete fields. The error I get is:

{
  "errors": [
    {
      "message": "itemDuplicationPaths is not iterable",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ]
}

I tried setting duplication paths for the collection (it didn’t have any before), but that didn’t resolve the issue.

One suspicion I have is that this might be related to previously using directus-extension-safe-rename to rename collections and fields. However, after a quick glance, I couldn’t find anything that looked wrong in the MySQL database.

For context, I also migrated from Directus 11.7 to 11.17 earlier.


Looking at the Docker container logs, I see:

[21:00:27.610] ERROR: itemDuplicationPaths is not iterable
    err: {
      "type": "TypeError",
      "message": "itemDuplicationPaths is not iterable",
      "stack":
          TypeError: itemDuplicationPaths is not iterable
              at getCollectionMetaUpdates (file:///directus/node_modules/.pnpm/@directus+api@file+api_@opentelemetry+api@1.9.0_@opentelemetry+core@2.1.0_@opentelemetr_4fe57fc2f23b0f156ebf7487ebe3f888/node_modules/@directus/api/dist/services/fields/get-collection-meta-updates.js:25:23)
              at file:///directus/node_modules/.pnpm/@directus+api@file+api_@opentelemetry+api@1.9.0_@opentelemetry+core@2.1.0_@opentelemetr_4fe57fc2f23b0f156ebf7487ebe3f888/node_modules/@directus/api/dist/services/fields.js:455:35
              at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
    }
[21:00:27] DELETE /fields/media/testtest 500 219ms

I tried locating the referenced code lines to possibly find the cause, but wasn’t sure where to find the specific lines exactly.


Does anyone have any ideas what might be causing this? I’d really love to somehow fix this in-place without having to go back to the previous backup from before all these changes.

1 Answer

1

I have found the cause:

I don’t know how, but somewhere along the way, the item_duplication_fields field in directus_collections of two collections has turned into "null" - not a value that is null, but the word “null” as a string.
This was the issue. I manually set values in the admin panel and saved. Worked like a charm afterwards.
These were on different collections than the one I tried deleting fields from, so I didn’t look at them earlier.