{"record":{"id":"2f40571b7a1b62a1","repo":"stride3d/stride","slug":"while-scanning-a-tag-did-not-find-expected-whitespace-or","errorCode":null,"errorMessage":"While scanning a tag, did not find expected whitespace or line break.","messagePattern":"While scanning a tag, did not find expected whitespace or line break\\.","errorType":"exception","errorClass":"SyntaxErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Scanner.cs","lineNumber":1278,"sourceCode":"\n\n                    // A special case: the '!' tag.  Set the handle to '' and the\n                    // suffix to '!'.\n\n\n                    if (suffix.Length == 0)\n                    {\n                        suffix = handle;\n                        handle = string.Empty;\n                    }\n                }\n            }\n\n            // Check the character which ends the tag.\n\n            if (!analyzer.IsBlankOrBreakOrZero())\n            {\n                throw new SyntaxErrorException(start, mark, \"While scanning a tag, did not find expected whitespace or line break.\");\n            }\n\n            // Create a token.\n\n            return new Tag(handle, suffix, start, mark);\n        }\n\n        /// <summary>\n        /// Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens.\n        /// </summary>\n        private void FetchBlockScalar(bool isLiteral)\n        {\n            // Remove any potential simple keys.\n\n            RemoveSimpleKey();\n\n            // A simple key may follow a block scalar.\n","sourceCodeStart":1260,"sourceCodeEnd":1296,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Scanner.cs#L1260-L1296","documentation":"After scanning a tag token (plain '!handle!suffix' or verbatim '!<...>'), ScanTag requires the next character to be a blank, line break, or end of input — a tag must be followed by whitespace. If a non-space character (e.g. a comma, letter, or quote) immediately follows the tag, this SyntaxErrorException is thrown.","triggerScenarios":"Writing a tag glued to surrounding content without a space, e.g. 'key:!foo' or '!tag,value', or two tags in a row '!a!!b'. Any parse of such input via Deserializer/YamlStream reaches the check after tag URI scanning and throws.","commonSituations":"Concatenated YAML where a tag was appended directly to a key or value without a separating space, macro/template expansion producing '!foo,value', and hand-edited manifests where a space was accidentally deleted after a custom tag.","solutions":["Insert a space after the tag: change 'key:!foo value' to 'key: !foo value'.","Ensure a tag appears only in tag positions — before a scalar, mapping, or sequence — never mid-token.","Check the reported column: the character right after the tag must be whitespace, newline, or EOF.","If the tag was intended as plain content, escape or quote it (e.g. \"'!foo,value'\") so the scanner treats it as a string.","Run a YAML linter over the document to catch missing whitespace around tags."],"exampleFix":"// before (no space after tag)\nkey:!custom value\n\n// after\nkey: !custom value","handlingStrategy":"validation","validationCode":"static bool TagsAreWhitespaceDelimited(string yaml)\n{\n    // a tag char sequence like !foo must be followed by space, newline, or EOF\n    return !System.Text.RegularExpressions.Regex.IsMatch(yaml, \"![A-Za-z0-9][^ \\\\t\\\\n\\\\r,\\\\[{]\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    var obj = deserializer.Deserialize<T>(input);\n}\ncatch (YamlException ex)\n{\n    throw new FormatException($\"Tag not followed by whitespace near {ex.Start.Line}:{ex.Start.Column}\", ex);\n}","preventionTips":["Always separate tags from surrounding tokens with a space: 'key: !tag value'","Never concatenate tag strings into content without whitespace","Place tags only immediately before scalars, mappings, or sequences","Run yamllint as a pre-commit check on YAML files"],"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"}