{"record":{"id":"b152a41637e228eb","repo":"stride3d/stride","slug":"no-collection-item-identifier-associated-to-the-given","errorCode":null,"errorMessage":"No Collection item identifier associated to the given collection.","messagePattern":"No Collection item identifier associated to the given collection\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/assets/Stride.Core.Assets.Quantum/Internal/AssetObjectNodeExtended.cs","lineNumber":106,"sourceCode":"            }\n            node.NotifyOverrideChanged();\n        }\n    }\n\n    public void DisconnectOverriddenDeletedItem(ItemId deletedId)\n    {\n        disconnectedDeletedIds.Add(deletedId);\n        OverrideDeletedItem(false, deletedId);\n    }\n\n    public bool IsItemDeleted(ItemId itemId)\n    {\n        if (disconnectedDeletedIds.Contains(itemId))\n            return true;\n\n        var collection = node.Retrieve();\n        if (!TryGetCollectionItemIds(collection, out var ids))\n            throw new InvalidOperationException(\"No Collection item identifier associated to the given collection.\");\n        return ids.IsDeleted(itemId);\n    }\n\n    private bool TryGetCollectionItemIds(object? instance, [MaybeNullWhen(false)] out CollectionItemIdentifiers itemIds)\n    {\n        if (collectionItemIdentifiers is not null)\n        {\n            itemIds = collectionItemIdentifiers;\n            return true;\n        }\n\n        var result = CollectionItemIdHelper.TryGetCollectionItemIds(instance, out collectionItemIdentifiers);\n        itemIds = collectionItemIdentifiers;\n        return result;\n    }\n\n    public void Restore(object restoredItem, ItemId id)\n    {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.Core.Assets.Quantum/Internal/AssetObjectNodeExtended.cs#L88-L124","documentation":"AssetObjectNodeExtended tracks collection item identities (CollectionItemIdentifiers) attached to a Quantum node. IsItemDeleted needs the id registry for the node's retrieved collection to check whether a given ItemId is deleted; if the retrieved instance has no associated CollectionItemIdentifiers, the invariant is broken and it throws InvalidOperationException.","triggerScenarios":"Calling IsItemDeleted (directly or via IsItemOverriddenDeleted) on a node whose Retrieve() returns an object for which TryGetCollectionItemIds fails — i.e. the node's collection has no collection-item-ids metadata (non-identifiable collection, metadata not yet attached, or node type changed).","commonSituations":"Querying deleted-item state on collections not marked identifiable; calling during partial deserialization before ids are attached; passing a node wrapping a non-collection or a collection stripped of its NonIdentifiableCollectionItemsAttribute metadata; asset edit-vs-base mismatch after type changes.","solutions":["Ensure the collection actually has collection item identifiers (no NonIdentifiableCollectionItemsAttribute) and that asset metadata was loaded/upgraded so ids exist before querying IsItemDeleted.","Use TryGetCollectionItemIds / TryIdToIndex-style checks (or CollectionItemIdHelper.HasCollectionItemIds) to verify ids exist before calling IsItemDeleted.","Verify the node passed in is the AssetObjectNode for a collection with identifiable items, not a different node type.","Re-save/migrate the asset so its collection ids metadata is regenerated."],"exampleFix":"// before\nbool deleted = nodeExtended.IsItemDeleted(itemId);\n// after\nif (CollectionItemIdHelper.HasCollectionItemIds(nodeExtended.Node.Retrieve()))\n    deleted = nodeExtended.IsItemDeleted(itemId);\nelse\n    deleted = false; // treat as non-identifiable collection","handlingStrategy":"validation","validationCode":"bool canQuery = CollectionItemIdHelper.HasCollectionItemIds(nodeExtended.Node.Retrieve());\nif (!canQuery) return false; // non-identifiable collection: no deleted ids","typeGuard":"static bool HasItemIds(AssetObjectNodeExtended n) =>\n    CollectionItemIdHelper.HasCollectionItemIds(n.Node.Retrieve());","tryCatchPattern":"try { deleted = nodeExtended.IsItemDeleted(itemId); }\ncatch (InvalidOperationException) { deleted = false; // ids missing }","preventionTips":["Check HasCollectionItemIds before id-based queries","Avoid NonIdentifiableCollectionItemsAttribute on collections you query by id","Ensure asset metadata is loaded/upgraded before override checks"],"tags":["stride","quantum","assets","collections","state"],"backgroundTag":"internal-invariant-violation","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}