{"record":{"id":"97a79b7d890bcaf8","repo":"stride3d/stride","slug":"while-scanning-a-tag-did-not-find-the-expected","errorCode":null,"errorMessage":"While scanning a tag, did not find the expected '>'.","messagePattern":"While scanning a tag, did not find the expected '>'\\.","errorType":"exception","errorClass":"SyntaxErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Scanner.cs","lineNumber":1228,"sourceCode":"            {\n                // Set the handle to ''\n\n                handle = string.Empty;\n\n                // Eat '!<'\n\n                Skip();\n                Skip();\n\n                // Consume the tag value.\n\n                suffix = ScanTagUri(null, start);\n\n                // Check for '>' and eat it.\n\n                if (!analyzer.Check('>'))\n                {\n                    throw new SyntaxErrorException(start, mark, \"While scanning a tag, did not find the expected '>'.\");\n                }\n\n                Skip();\n            }\n            else\n            {\n                // The tag has either the '!suffix' or the '!handle!suffix' form.\n\n                // First, try to scan a handle.\n\n                string firstPart = ScanTagHandle(false, start);\n\n                // Check if it is, indeed, handle.\n\n                if (firstPart.Length > 1 && firstPart[0] == '!' && firstPart[firstPart.Length - 1] == '!')\n                {\n                    handle = firstPart;\n","sourceCodeStart":1210,"sourceCodeEnd":1246,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Scanner.cs#L1210-L1246","documentation":"When the Scanner encounters a verbatim tag of the form '!<suffix>' (ScanTag), it scans the URI inside the angle brackets and then requires a closing '>'. If the input stream ends, or a non-'>' character appears where the closing bracket should be, this SyntaxErrorException is thrown.","triggerScenarios":"A tag directive-style value written as '!<tag:example.com,2000:app/foo' without the closing '>', or '!<>' with an empty suffix path, or a truncated stream where the '>' was cut off. Reached whenever the tokenizer processes '!<...' input via Deserialize/Load.","commonSituations":"Hand-written custom tags missing the closing bracket, minification/line-wrapping tools that split '!<...>' across lines or dropped the '>' during copy-paste, and YAML produced by code that builds verbatim tags via string concatenation.","solutions":["Add the missing '>' to close the verbatim tag: '!<tag:example.com,2000:app/foo>'.","Verify the tag is not empty after '!<' — verbatim tags require at least a '/' suffix if using the primary namespace.","Check the reported line for truncation from editors, diff tools, or copy-paste that dropped the trailing '>'.","If you do not need a verbatim tag, use a simple tag shorthand like '!Foo' or a %TAG directive instead.","Validate the document with a YAML parser/linter before loading to catch unbalanced tag delimiters."],"exampleFix":"// before (missing closing '>')\nvalue: !<tag:example.com,2000:thing\n\n// after\nvalue: !<tag:example.com,2000:thing>","handlingStrategy":"validation","validationCode":"static bool HasBalancedVerbatimTags(string yaml)\n{\n    for (int i = yaml.IndexOf(\"!<\"); i >= 0; i = yaml.IndexOf(\"!<\", i + 1))\n    {\n        int close = yaml.IndexOf('>', i);\n        if (close < 0 || close == i + 2) return false; // no '>' or empty tag\n    }\n    return true;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    yamlStream.Load(reader);\n}\ncatch (YamlException ex)\n{\n    throw new FormatException($\"Malformed verbatim tag near {ex.Start.Line}:{ex.Start.Column}: {ex.Message}\", ex);\n}","preventionTips":["Never hand-write verbatim tags; prefer !Name shorthand or %TAG directives","Check every '!<' has a matching '>' on the same line","Do not line-wrap or reflow YAML containing verbatim tags with naive tools","Validate YAML with a linter before loading generated documents"],"tags":["yaml","parser","tags"],"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-23T08:17:48.524Z"}