{"record":{"id":"5f6dbd98ecda4859","repo":"stride3d/stride","slug":"while-parsing-a-tag-did-not-find-expected-tag-uri","errorCode":null,"errorMessage":"While parsing a tag, did not find expected tag URI.","messagePattern":"While parsing a tag, did not find expected tag URI\\.","errorType":"exception","errorClass":"SyntaxErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Scanner.cs","lineNumber":2142,"sourceCode":"            while (analyzer.IsAlpha() || analyzer.Check(\";/?:@&=+$,.!~*'()[]%\"))\n            {\n                // Check if it is a URI-escape sequence.\n\n                if (analyzer.Check('%'))\n                {\n                    tag.Append(ScanUriEscapes(start));\n                }\n                else\n                {\n                    tag.Append(ReadCurrentCharacter());\n                }\n            }\n\n            // Check if the tag is non-empty.\n\n            if (tag.Length == 0)\n            {\n                throw new SyntaxErrorException(start, mark, \"While parsing a tag, did not find expected tag URI.\");\n            }\n\n            return tag.ToString();\n        }\n\n        /// <summary>\n        /// Decode an URI-escape sequence corresponding to a single UTF-8 character.\n        /// </summary>\n        private char ScanUriEscapes(Mark start)\n        {\n            // Decode the required number of characters.\n\n            List<byte> charBytes = new List<byte>();\n            int width = 0;\n            do\n            {\n                // Check for a URI-escaped octet.\n","sourceCodeStart":2124,"sourceCodeEnd":2160,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Scanner.cs#L2124-L2160","documentation":"The YAML scanner (Scanner.ScanTag) finished reading a tag token but the accumulated tag text was empty, i.e. there was no tag URI after the handle. A YAML tag like '!!str' or '!foo' must contain a URI part, so the scanner throws a SyntaxErrorException tied to the parse position. This is a malformed-YAML input error, not a runtime API misuse.","triggerScenarios":"Parsing YAML text where a tag token starts with '!' but no URI characters follow before the tag ends (e.g. '!!' followed by whitespace, or '!' at end of input). Reached via Deserializer/Serializer deserialize calls on a YamlStream/EventReader.","commonSituations":"Hand-edited YAML config files with a truncated tag like 'key: !!' or 'key: !'; copy-paste corruption that dropped the tag suffix; templating that emitted an empty tag placeholder.","solutions":["Fix the YAML source so the tag has a URI, e.g. change 'key: !!' to 'key: !!str' or 'key: !MyType value'.","If you did not intend a tag, remove the stray '!' characters entirely.","Validate the YAML with a linter/parser before feeding it to Stride.Core.Yaml.","Catch SyntaxErrorException in the deserialization call and surface the mark (line/column) to the user."],"exampleFix":"// before (input.yaml)\nlogo: !!\n\n// after (input.yaml)\nlogo: !!str \"data:image/png;base64,...\"","handlingStrategy":"validation","validationCode":"// C#\nif (yamlText.Contains(\"!!\") || System.Text.RegularExpressions.Regex.IsMatch(yamlText, @\"!\\s*[:\\n]\"))\n    throw new FormatException(\"YAML contains an empty tag '!'; a tag URI must follow the handle.\");","typeGuard":null,"tryCatchPattern":"try { deserializer.Deserialize(reader, targetType); }\ncatch (SyntaxErrorException ex) { throw new YamlConfigException($\"Malformed tag at line {ex.Start.Line}, col {ex.Start.Column}\", ex); }","preventionTips":["Always write tags in full form: !!str, !!map, or !YourType.","Lint YAML files in CI with a YAML parser before deployment.","Avoid hand-editing tagged YAML; use templates that emit complete tags."],"tags":["yaml","parsing","scanner"],"backgroundTag":"yaml-parse-error","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}