{"record":{"id":"b4cb0f3433a696a6","repo":"stride3d/stride","slug":"anchor-value-must-not-be-empty","errorCode":null,"errorMessage":"Anchor value must not be empty.","messagePattern":"Anchor value must not be empty\\.","errorType":"exception","errorClass":"YamlException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Events/AnchorAlias.cs","lineNumber":85,"sourceCode":"        private readonly string value;\n\n        /// <summary>\n        /// Gets the value of the alias.\n        /// </summary>\n        public string Value { get { return value; } }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"AnchorAlias\"/> class.\n        /// </summary>\n        /// <param name=\"value\">The value of the alias.</param>\n        /// <param name=\"start\">The start position of the event.</param>\n        /// <param name=\"end\">The end position of the event.</param>\n        public AnchorAlias(string value, Mark start, Mark end)\n            : base(start, end)\n        {\n            if (string.IsNullOrEmpty(value))\n            {\n                throw new YamlException(start, end, \"Anchor value must not be empty.\");\n            }\n\n            if (!NodeEvent.anchorValidator.IsMatch(value))\n            {\n                throw new YamlException(start, end, \"Anchor value must contain alphanumerical characters only.\");\n            }\n\n            this.value = value;\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"AnchorAlias\"/> class.\n        /// </summary>\n        /// <param name=\"value\">The value of the alias.</param>\n        public AnchorAlias(string value)\n            : this(value, Mark.Empty, Mark.Empty)\n        {\n        }","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Events/AnchorAlias.cs#L67-L103","documentation":"AnchorAlias events represent *x references to an anchor; the alias value must be a non-empty string matching the anchor grammar. The constructor throws this YamlException (with position marks) when the alias value is null or empty, before any parsing/emitting proceeds.","triggerScenarios":"new AnchorAlias(\"\", start, end) or new AnchorAlias(null, start, end); alias nodes generated from deserialized data where the anchor name was lost or empty.","commonSituations":"Programmatic construction of YAML event graphs; pipelines that convert anchors/aliases from other formats and lose the name; templates that interpolate an anchor variable which resolved to an empty string.","solutions":["Pass the actual anchor name to the AnchorAlias constructor","Validate that the anchor string is non-empty before constructing the event","Skip emitting the alias (emit the anchored node inline instead) when no anchor name exists","Fix the upstream code that produced the empty anchor reference"],"exampleFix":"// before\nvar alias = new AnchorAlias(aliasName, start, end);\n// after\nif (string.IsNullOrEmpty(aliasName)) throw new InvalidOperationException(\"Alias name missing\");\nvar alias = new AnchorAlias(aliasName, start, end);","handlingStrategy":"validation","validationCode":"bool ok = !string.IsNullOrEmpty(aliasName);\nif (!ok) throw new ArgumentException(\"Alias name is required\");","typeGuard":null,"tryCatchPattern":"try { var alias = new AnchorAlias(name, start, end); }\ncatch (YamlException ex) when (ex.Message.Contains(\"must not be empty\")) { /* emit the node inline instead of an alias */ }","preventionTips":["Never interpolate anchor names from data that may be empty","Skip aliases when the anchor name was lost and inline the node instead","Validate anchor references when converting from other formats"],"tags":["yaml","anchor","alias"],"backgroundTag":"empty-required-field","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"}