stride3d/stride · error · NodePresenterException
An error occurred while adding an item to the node, see the…
Error message
An error occurred while adding an item to the node, see the inner exception for more information.
What it means
MemberNodePresenter.AddItem(value) wraps any exception thrown by Member.Target.Add(value) in a NodePresenterException. Member.Target is the Quantum object node of the member's collection; failures inside that Add (type mismatch, unsupported collection, reflection errors) are wrapped so the presenter layer throws a single NodePresenterException with the cause in InnerException. Callers should treat the InnerException as authoritative.
Solutions
- Catch NodePresenterException and inspect InnerException for the real failure.
- Before adding, guard with the same checks the presenter uses: Member.Target != null && Member.Target.IsEnumerable, and confirm the element type is compatible with value.
- Ensure the model member is declared as a mutable collection (List<T>, Dictionary<K,V>) rather than an array or IEnumerable.
- Perform the add on the UI thread and on the current node instance; refresh the presenter if the member's object was replaced.
Example fix
// before
memberPresenter.AddItem(newItem); // member is int[] -> wrapped exception
// after
// model change: public int[] Items -> public List<int> Items
if (memberPresenter.IsEnumerable)
memberPresenter.AddItem(newItem); Defensive patterns
Strategy: type-guard
Validate before calling
if (memberPresenter.Member?.Target == null || !memberPresenter.IsEnumerable)
throw new InvalidOperationException("Member is not a collection.");
var elementType = memberPresenter.Descriptor.GetInnerCollectionType();
if (!elementType.IsInstanceOfType(value))
throw new ArgumentException($"{value.GetType()} not assignable to element type {elementType}"); Type guard
static bool CanAddToMember(MemberNodePresenter m, object value)
=> m.Member?.Target != null
&& m.IsEnumerable
&& m.Descriptor.GetInnerCollectionType().IsInstanceOfType(value); Try / catch
try
{
memberPresenter.AddItem(value);
}
catch (NodePresenterException ex)
{
logger.Error(ex.InnerException, "Add failed on member {Name}", memberPresenter.Name);
// common causes: array/read-only target, wrong element type
} Prevention
- Guard with Member.Target != null && IsEnumerable and an element-type check before every AddItem.
- Declare model collection members as mutable types (List<T>, Dictionary<K,V>), never arrays or IEnumerable.
- Add on the UI thread so Quantum change notifications and presenter refreshes stay consistent.
- Diagnose via InnerException - the outer NodePresenterException message is generic by design.
When it happens
Trigger: Calling MemberNodePresenter.AddItem(value) when: the member's collection element type does not accept value, the collection is an array or read-only/fixed-size type with no Add, Member.Target exists and reports IsEnumerable but its runtime type lacks a compatible Add, or the underlying reflection helper throws.
Common situations: Editor 'Add item' buttons on a property whose collection was changed to an array or IReadOnlyList; dragging items of the wrong type into a list; model classes changed between Stride versions so the member's target is no longer a mutable collection.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- An error occurred while adding an item to the node, see the…
- An error occurred while removing an item to the node, see…
- An error occurred while updating the value of the node, see…
- Unable to find the base
- Unable to find the graph corresponding to the base part
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/d043c999e89addc0.
Report an issue: GitHub.
Appendix: source
Thrown at sources/presentation/Stride.Core.Presentation.Quantum/Presenters/MemberNodePresenter.cs:105
}
catch (Exception e)
{
throw new NodePresenterException("An error occurred while updating the value of the node, see the inner exception for more information.", e);
}
}
public override void AddItem(object value)
{
if (Member.Target == null || !Member.Target.IsEnumerable)
throw new NodePresenterException($"{nameof(MemberNodePresenter)}.{nameof(AddItem)} cannot be invoked on members that are not collection.");
try
{
Member.Target.Add(value);
}
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 AddItem(object value, NodeIndex index)
{
if (Member.Target == null || !Member.Target.IsEnumerable)
throw new NodePresenterException($"{nameof(MemberNodePresenter)}.{nameof(AddItem)} cannot be invoked on members that are not collection.");
try
{
Member.Target.Add(value, index);
}
catch (Exception e)
{
throw new NodePresenterException("An error occurred while adding an item to the node, see the inner exception for more information.", e);
}
}
View on GitHub (pinned to 96fad776d2)