{"record":{"id":"c9ab10c92e65037d","repo":"stride3d/stride","slug":"the-path-tostring-item-doesn-t-exsit-on-a-set","errorCode":null,"errorMessage":"The path [{ToString()}] item doesn't exsit on a set.","messagePattern":"The path \\[(.+?)\\] item doesn't exsit on a set\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"sources/assets/Stride.Core.Assets/Yaml/YamlAssetPath.cs","lineNumber":265,"sourceCode":"                            if (item.Value is not int)\n                            {\n                                throw new InvalidOperationException($\"The path [{ToString()}] contains non-integer index on an array.\");\n                            }\n                            int value = (int)item.Value;\n                            memberPath.Push(arrayDescriptor, value);\n                            currentObject = arrayDescriptor.GetValue(currentObject, value);\n                        }\n                        else if (typeDescriptor is CollectionDescriptor collectionDescriptor)\n                        {\n                            if (collectionDescriptor is SetDescriptor setDescriptor)\n                            {\n                                if (item.Value is null && !collectionDescriptor.ElementType.IsNullable())\n                                {\n                                    throw new InvalidOperationException($\"The path [{ToString()}] contains a null item on a set.\");\n                                }\n                                if (!setDescriptor.Contains(currentObject, item.Value))\n                                {\n                                    throw new InvalidOperationException($\"The path [{ToString()}] item doesn't exsit on a set.\");\n                                }\n                                memberPath.Push(setDescriptor, item.Value);\n                                currentObject = item.Value;\n                            }\n                            else\n                            {\n                                if (item.Value is not int)\n                                {\n                                    throw new InvalidOperationException($\"The path [{ToString()}] contains non-integer index on a collection.\");\n                                }\n                                memberPath.Push(collectionDescriptor, item.Value);\n                                currentObject = collectionDescriptor.GetValue(currentObject, item.Value);\n                            }\n                        }\n                        else if (typeDescriptor is DictionaryDescriptor dictionaryDescriptor)\n                        {\n                            if (item.Value is null) throw new InvalidOperationException($\"The path [{ToString()}] contains a null key on an dictionary.\");\n                            memberPath.Push(dictionaryDescriptor, item.Value);","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/assets/Stride.Core.Assets/Yaml/YamlAssetPath.cs#L247-L283","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Update or remove the stale path entry in the asset YAML so it matches an existing set item","Restore/re-add the missing item to the set in code, or accept the reference loss and re-link in the editor","Fix upstream code that mutates the set before ToMemberPath is called","Catch InvalidOperationException around ToMemberPath and treat unresolvable paths as broken references to repair"],"exampleFix":"// before\nmySet.Remove(oldItem); // asset yaml still points at oldItem\n// after\nmySet.Add(newItem); // and update the asset path to reference newItem","handlingStrategy":"validation","validationCode":"if (!set.Contains(item.Value)) throw new ArgumentException($\"Set does not contain item {item.Value}\");","typeGuard":"bool SetHasItem<T>(ISet<T> set, T v) => v != null && set.Contains(v);","tryCatchPattern":"try { memberPath = yamlPath.ToMemberPath(); } catch (InvalidOperationException) { RepairBrokenReference(asset, yamlPath); }","preventionTips":["Regenerate asset references after renaming or deleting set items","Keep assets in sync with code changes that mutate set contents","Run a reference-repair pass over assets after version upgrades","Treat unresolvable paths as broken links and re-link rather than crashing"],"tags":["yaml","asset-path","sets","stale-reference"],"backgroundTag":"entity-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}