{"record":{"id":"b5232ae7623877fc","repo":"stride3d/stride","slug":"the-node-does-not-contain-enumerable-references","errorCode":null,"errorMessage":"The node does not contain enumerable references.","messagePattern":"The node does not contain enumerable references\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Quantum/ObjectNode.cs","lineNumber":76,"sourceCode":"\n    /// <inheritdoc/>\n    public event EventHandler<ItemChangeEventArgs>? ItemChanging;\n\n    /// <inheritdoc/>\n    public event EventHandler<ItemChangeEventArgs>? ItemChanged;\n\n    /// <inheritdoc/>\n    public IMemberNode? TryGetChild(string name)\n    {\n        childrenMap.TryGetValue(name, out var child);\n        return child;\n    }\n\n    /// <inheritdoc/>\n    public IObjectNode? IndexedTarget(NodeIndex index)\n    {\n        if (index == NodeIndex.Empty) throw new ArgumentException(\"index cannot be Index.Empty when invoking this method.\", nameof(index));\n        if (ItemReferences == null) throw new InvalidOperationException(\"The node does not contain enumerable references.\");\n        return ItemReferences[index].TargetNode;\n    }\n\n    /// <inheritdoc/>\n    public void Update(object? newValue, NodeIndex index)\n    {\n        Update(newValue, index, true);\n    }\n\n    /// <inheritdoc/>\n    public void Add(object newItem)\n    {\n        if (Descriptor is CollectionDescriptor collectionDescriptor)\n        {\n            NodeIndex index = NodeIndex.Empty;\n            switch (collectionDescriptor.Category)\n            {\n                case DescriptorCategory.List:","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Quantum/ObjectNode.cs#L58-L94","documentation":"IndexedTarget dereferences ItemReferences, which is only populated when the node was created with a ReferenceEnumerable (i.e. it represents a node whose collection items hold references). Nodes without enumerable references throw InvalidOperationException because there is nothing to look up. This is a state error: the API was invoked on a node that cannot support it.","triggerScenarios":"Calling IndexedTarget on an ObjectNode whose ItemReferences is null — i.e. a plain object node or one created with reference = null — regardless of whether the index is valid.","commonSituations":"Generic node-visiting code that calls IndexedTarget on every node without checking whether it is a reference-holding (item-reference) node; nodes created before references were attached; mixing ordinary collection nodes with reference-observable nodes.","solutions":["Check 'node.ItemReferences != null' (or wrap in try/catch for InvalidOperationException) before calling IndexedTarget","Only call IndexedTarget on nodes that were created with a ReferenceEnumerable / reference-aware builder path","Use the regular indexed item access (this[NodeIndex]) for non-reference collection items instead","Restructure so the node whose targets you need is created with item references enabled"],"exampleFix":"// before\nvar target = node.IndexedTarget(index); // InvalidOperationException on plain nodes\n// after\nif (node.ItemReferences != null)\n    var target = node.IndexedTarget(index);\nelse\n    var target = node[index].Target;","handlingStrategy":"type-guard","validationCode":"if (node is ObjectNode on && on.ItemReferences == null) throw new InvalidOperationException(\"Node has no enumerable references\");","typeGuard":"static bool SupportsIndexedTargets(ObjectNode node) => node.ItemReferences != null;","tryCatchPattern":"try { target = node.IndexedTarget(index); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"enumerable references\"))\n{ /* fall back to regular indexed item access or skip node */ }","preventionTips":["Only call IndexedTarget on nodes created with a ReferenceEnumerable","Check ItemReferences != null before reference lookups","In generic node visitors, branch on node kind/reference capability before using reference APIs"],"tags":["csharp","quantum","node-graph","invalid-operation"],"backgroundTag":"invalid-state-transition","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"}