{"record":{"id":"5b8e2af07156264b","repo":"stride3d/stride","slug":"while-scanning-for-the-next-token-find-character-that-cannot","errorCode":null,"errorMessage":"While scanning for the next token, find character that cannot start any token.","messagePattern":"While scanning for the next token, find character that cannot start any token\\.","errorType":"exception","errorClass":"SyntaxErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Scanner.cs","lineNumber":509,"sourceCode":"\n            // The last rule is more restrictive than the specification requires.\n\n\n            bool isInvalidPlainScalarCharacter = analyzer.IsBlankOrBreakOrZero() || analyzer.Check(\"-?:,[]{}#&*!|>'\\\"%@`\");\n\n            bool isPlainScalar =\n                !isInvalidPlainScalarCharacter ||\n                (analyzer.Check('-') && !analyzer.IsBlank(1)) ||\n                (flowLevel == 0 && (analyzer.Check(\"?:\")) && !analyzer.IsBlankOrBreakOrZero(1));\n\n            if (isPlainScalar)\n            {\n                FetchPlainScalar();\n                return;\n            }\n\n            // If we don't determine the token type so far, it is an error.\n            throw new SyntaxErrorException(mark, mark, \"While scanning for the next token, find character that cannot start any token.\");\n        }\n\n        private bool CheckWhiteSpace()\n        {\n            return analyzer.Check(' ') || ((flowLevel > 0 || !simpleKeyAllowed) && analyzer.Check('\\t'));\n        }\n\n        private bool IsDocumentIndicator()\n        {\n            if (mark.Column == 0 && analyzer.IsBlankOrBreakOrZero(3))\n            {\n                bool isDocumentStart = analyzer.Check('-', 0) && analyzer.Check('-', 1) && analyzer.Check('-', 2);\n                bool isDocumentEnd = analyzer.Check('.', 0) && analyzer.Check('.', 1) && analyzer.Check('.', 2);\n\n                return isDocumentStart || isDocumentEnd;\n            }\n            else\n            {","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Scanner.cs#L491-L527","documentation":"The tokenizer encountered a character that cannot begin any YAML token (neither indicator, scalar start, whitespace, nor comment). The scanner's character dispatch fell through all Fetch* branches and threw this SyntaxErrorException.","triggerScenarios":"A control character, stray '@' or '`' (reserved indicators), or an invalid byte at the start of a token position in the YAML stream.","commonSituations":"Copy-pasted text carrying invisible control characters, binary data accidentally pasted into a YAML file, or characters like `@tools` at line start which YAML reserves.","solutions":["Find the offending character at the reported offset and remove or replace it","Quote the line as a string or strip non-printable bytes (re-save file as UTF-8 without control chars)","Check for BOM or invisible characters with `cat -A` or a hex editor","Replace reserved indicators ('@', '`') at token start with quoted strings"],"exampleFix":"// before\n@tag: value   # '@' cannot start a token\n// after\ntag: \"@value\"","handlingStrategy":"validation","validationCode":"// Strip/reject non-printable characters before parsing\nforeach (char c in yamlText) if (char.IsControl(c) && c != '\\n' && c != '\\r' && c != '\\t') throw new FormatException($\"Control char U+{(int)c:X4} in YAML input\");","typeGuard":"bool IsSafeYamlStart(string s) { var t = s.TrimStart(); return t.Length == 0 || (t[0] != '@' && t[0] != '`'); }","tryCatchPattern":"catch (SyntaxErrorException ex) { throw new ConfigFormatException($\"Invalid character near offset {ex.Start.Line}:{ex.Start.Column}\"); }","preventionTips":["Re-save files as UTF-8 and strip control characters","Avoid pasting from rich-text sources that inject invisible chars","Never start a line with reserved indicators '@' or '`'; quote if needed","Check files with `cat -A` when parsing fails oddly"],"tags":["yaml","scanner","invalid-characters"],"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"}