stride3d/stride · error · NodePresenterException

An error occurred while removing an item to the node, see…

Error message

An error occurred while removing an item to the node, see the inner exception for more information.

What it means

RootNodePresenter.RemoveItem wraps RootNode.Remove(value, index) and rethrows failures as NodePresenterException with the original exception as InnerException. It signals that removing an item from the root node failed. The actual error is the inner exception.

Solutions

  1. Check the InnerException for the real cause.
  2. Verify the item exists at the given NodeIndex before removal.
  3. Ensure the root collection supports removal (not read-only/fixed-size).
  4. Re-sync the presenter with the current model state if it is stale.

Example fix

// before
rootNodePresenter.RemoveItem(value, index); // throws if already removed
// after
if (rootNode.IsEnumerable && rootNode.Content is IDictionary dict && dict.Contains(index.Value))
    rootNodePresenter.RemoveItem(value, index);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!rootNodePresenter.RootNode.IsEnumerable)
    throw new InvalidOperationException("Root node is not enumerable; RemoveItem will fail.");

Type guard

static bool CanRemoveFromRoot(RootNodePresenter p) => p != null && p.RootNode?.IsEnumerable == true;

Try / catch

try
{
    rootNodePresenter.RemoveItem(value, index);
}
catch (NodePresenterException ex)
{
    logger.Error(ex.InnerException, "RemoveItem failed on root node");
}

Prevention

When it happens

Trigger: Calling RootNodePresenter.RemoveItem(value, index) when RootNode.Remove(value, index) throws — item missing, read-only collection, or model-side validation failure.

Common situations: Deleting a root-level dictionary/list entry that was already removed or never existed; fixed-size arrays exposed as root collections; concurrent modification of the underlying model.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/089a1bef6bfb3bb6. Report an issue: GitHub.

Appendix: source

Thrown at sources/presentation/Stride.Core.Presentation.Quantum/Presenters/RootNodePresenter.cs:100

            }
            catch (Exception e)
            {
                throw new NodePresenterException("An error occurred while adding an item to the node, see the inner exception for more information.", e);
            }
        }

        public override void RemoveItem(object value, NodeIndex index)
        {
            if (!RootNode.IsEnumerable)
                throw new NodePresenterException($"{nameof(RootNodePresenter)}.{nameof(RemoveItem)} cannot be invoked on objects that are not collection.");

            try
            {
                RootNode.Remove(value, index);
            }
            catch (Exception e)
            {
                throw new NodePresenterException("An error occurred while removing an item to the node, see the inner exception for more information.", e);
            }
        }

        public override NodeAccessor GetNodeAccessor()
        {
            return new NodeAccessor(RootNode, NodeIndex.Empty);
        }

        private void OnItemChanging(object? sender, ItemChangeEventArgs e)
        {
            RaiseValueChanging(Value);
        }

        private void OnItemChanged(object? sender, ItemChangeEventArgs e)
        {
            Refresh();
            RaiseValueChanged(Value);
        }

View on GitHub (pinned to 96fad776d2)