stride3d/stride · error · InvalidOperationException

The path [ ] item doesn't exsit on a set.

Error message

The path [{ToString()}] item doesn't exsit on a set.

What it means

Thrown by YamlAssetPath.ToMemberPath when a path element names an item that does not exist in the target set. Because sets are keyed by their element value, SetDescriptor.Contains is checked first; if the item is absent the path cannot be resolved and the library throws (note the typo 'exsit' in the message).

Solutions

  1. Update or remove the stale path entry in the asset YAML so it matches an existing set item
  2. Restore/re-add the missing item to the set in code, or accept the reference loss and re-link in the editor
  3. Fix upstream code that mutates the set before ToMemberPath is called
  4. Catch InvalidOperationException around ToMemberPath and treat unresolvable paths as broken references to repair

Example fix

// before
mySet.Remove(oldItem); // asset yaml still points at oldItem
// after
mySet.Add(newItem); // and update the asset path to reference newItem
Defensive patterns

Strategy: validation

Validate before calling

if (!set.Contains(item.Value)) throw new ArgumentException($"Set does not contain item {item.Value}");

Type guard

bool SetHasItem<T>(ISet<T> set, T v) => v != null && set.Contains(v);

Try / catch

try { memberPath = yamlPath.ToMemberPath(); } catch (InvalidOperationException) { RepairBrokenReference(asset, yamlPath); }

Prevention

When it happens

Trigger: ToMemberPath resolves a set property, then setDescriptor.Contains(currentObject, item.Value) returns false — the referenced value was removed, renamed, or never existed in the live object.

Common situations: Renaming or deleting an item in code while old asset YAML still references it; assets shared between project versions where the set contents diverged; GUID/key regeneration breaking stored references.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at sources/assets/Stride.Core.Assets/Yaml/YamlAssetPath.cs:265

                            if (item.Value is not int)
                            {
                                throw new InvalidOperationException($"The path [{ToString()}] contains non-integer index on an array.");
                            }
                            int value = (int)item.Value;
                            memberPath.Push(arrayDescriptor, value);
                            currentObject = arrayDescriptor.GetValue(currentObject, value);
                        }
                        else if (typeDescriptor is CollectionDescriptor collectionDescriptor)
                        {
                            if (collectionDescriptor is SetDescriptor setDescriptor)
                            {
                                if (item.Value is null && !collectionDescriptor.ElementType.IsNullable())
                                {
                                    throw new InvalidOperationException($"The path [{ToString()}] contains a null item on a set.");
                                }
                                if (!setDescriptor.Contains(currentObject, item.Value))
                                {
                                    throw new InvalidOperationException($"The path [{ToString()}] item doesn't exsit on a set.");
                                }
                                memberPath.Push(setDescriptor, item.Value);
                                currentObject = item.Value;
                            }
                            else
                            {
                                if (item.Value is not int)
                                {
                                    throw new InvalidOperationException($"The path [{ToString()}] contains non-integer index on a collection.");
                                }
                                memberPath.Push(collectionDescriptor, item.Value);
                                currentObject = collectionDescriptor.GetValue(currentObject, item.Value);
                            }
                        }
                        else if (typeDescriptor is DictionaryDescriptor dictionaryDescriptor)
                        {
                            if (item.Value is null) throw new InvalidOperationException($"The path [{ToString()}] contains a null key on an dictionary.");
                            memberPath.Push(dictionaryDescriptor, item.Value);

View on GitHub (pinned to 96fad776d2)