{"record":{"id":"313af8097fb7c19b","repo":"stride3d/stride","slug":"unable-to-find-alias","errorCode":null,"errorMessage":"Unable to find alias","messagePattern":"Unable to find alias","errorType":"exception","errorClass":"AnchorNotFoundException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Serialization/Serializers/AnchorSerializer.cs","lineNumber":81,"sourceCode":"        public bool TryGetAliasValue(string alias, out object value)\n        {\n            return aliasToObject.TryGetValue(alias, out value);\n        }\n\n        public override object ReadYaml(ref ObjectContext objectContext)\n        {\n            var context = objectContext.SerializerContext;\n            var reader = context.Reader;\n            object value = null;\n\n            // Process Anchor alias (*oxxx)\n            var alias = reader.Allow<AnchorAlias>();\n            if (alias != null)\n            {\n                // Return an alias or directly the value\n                if (!aliasToObject.TryGetValue(alias.Value, out value))\n                {\n                    throw new AnchorNotFoundException(alias.Value, alias.Start, alias.End, \"Unable to find alias\");\n                }\n                return value;\n            }\n\n            // Test if current node has an anchor &oxxx\n            string anchor = null;\n            var nodeEvent = reader.Peek<NodeEvent>();\n            if (nodeEvent != null && !string.IsNullOrEmpty(nodeEvent.Anchor))\n            {\n                anchor = nodeEvent.Anchor;\n            }\n\n            // Deserialize the current node\n            value = base.ReadYaml(ref objectContext);\n\n            // Store Anchor (&oxxx) and override any defined anchor \n            if (anchor != null)\n            {","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Serialization/Serializers/AnchorSerializer.cs#L63-L99","documentation":"While reading YAML, an alias node like *anchorName was encountered, but the AnchorSerializer has no recorded object for that alias — the anchor (&name) was never defined earlier in the document or was not kept. This throws an AnchorNotFoundException carrying 'Unable to find alias'.","triggerScenarios":"Deserializing a YAML document containing `*alias` whose matching `&alias` anchor is absent, out of order, or stripped by preprocessing/merging of documents.","commonSituations":"Hand-edited YAML where an anchor was renamed/deleted; tooling that re-emits YAML without preserving anchors; concatenating YAML fragments where the anchor lives in another file.","solutions":["Fix the YAML so every alias has a preceding matching anchor definition (&name) in the same document","Remove or inline the dangling alias if shared data is no longer needed","Catch YamlException/AnchorNotFoundException during deserialization and report the document location"],"exampleFix":"// before (yaml)\nvalue: *missingAnchor\n// after (yaml)\nbase: &missingAnchor { x: 1 }\nvalue: *missingAnchor","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return serializer.Deserialize(reader, type); } catch (YamlException ex) when (ex.InnerException is AnchorNotFoundException) { throw new InvalidDataException($\"Dangling YAML alias at {ex.Start}-{ex.End}\", ex); }","preventionTips":["Ensure every *alias has a preceding &anchor in the same document","Avoid stripping anchors when merging or preprocessing YAML","Prefer explicit inline data over cross-document aliases"],"tags":["yaml","alias","deserialization","undefined-reference"],"backgroundTag":"yaml-undefined-anchor","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}