{"record":{"id":"78b7d049f11bcc82","repo":"stride3d/stride","slug":"while-parsing-a-tag-find-an-incorrect-trailing-utf-8-octet","errorCode":null,"errorMessage":"While parsing a tag, find an incorrect trailing UTF-8 octet.","messagePattern":"While parsing a tag, find an incorrect trailing UTF-8 octet\\.","errorType":"exception","errorClass":"SyntaxErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Scanner.cs","lineNumber":2190,"sourceCode":"                if (width == 0)\n                {\n                    width = (octet & 0x80) == 0x00 ? 1 :\n                        (octet & 0xE0) == 0xC0 ? 2 :\n                            (octet & 0xF0) == 0xE0 ? 3 :\n                                (octet & 0xF8) == 0xF0 ? 4 : 0;\n\n                    if (width == 0)\n                    {\n                        throw new SyntaxErrorException(start, mark, \"While parsing a tag, find an incorrect leading UTF-8 octet.\");\n                    }\n                }\n                else\n                {\n                    // Check if the trailing octet is correct.\n\n                    if ((octet & 0xC0) != 0x80)\n                    {\n                        throw new SyntaxErrorException(start, mark, \"While parsing a tag, find an incorrect trailing UTF-8 octet.\");\n                    }\n                }\n\n                // Copy the octet and move the pointers.\n\n                charBytes.Add((byte) octet);\n\n                Skip();\n                Skip();\n                Skip();\n            } while (--width > 0);\n\n            char[] characters = Encoding.UTF8.GetChars(charBytes.ToArray());\n\n            if (characters.Length != 1)\n            {\n                throw new SyntaxErrorException(start, mark, \"While parsing a tag, find an incorrect UTF-8 sequence.\");\n            }","sourceCodeStart":2172,"sourceCodeEnd":2208,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Scanner.cs#L2172-L2208","documentation":"While decoding a multi-byte UTF-8 character in a tag URI (Scanner.ScanTagUri), a continuation octet must have the form 10xxxxxx ((octet & 0xC0) == 0x80). If an escaped octet in the middle of a sequence does not, the sequence is malformed and the scanner throws SyntaxErrorException.","triggerScenarios":"A tag's %XX escape sequence declares a multi-byte character (e.g. starts with %E0 or %C3) but a following octet is not a continuation byte, e.g. '!%C3%4G' or '!%E0%A0' with a bad third byte.","commonSituations":"Truncated or hand-assembled percent escapes; byte-level string manipulation (substring in the middle of a character); data corrupted when passing through a non-UTF-8-safe channel.","solutions":["Repair the escape sequence so all continuation bytes are 0x80-0xBF (e.g. complete %C3%A9).","Regenerate the tag encoding by re-encoding the intended Unicode string as UTF-8 then percent-encoding.","Shorten the tag to end at a character boundary if the tail is corrupt.","Catch SyntaxErrorException and report the exact mark for debugging the input."],"exampleFix":"// before (input.yaml)\nlabel: !%C3%28\n\n// after (input.yaml)\nlabel: !%C3%A9","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { deserializer.Deserialize(reader, targetType); }\ncatch (SyntaxErrorException ex) { throw new YamlConfigException($\"Broken multi-byte UTF-8 escape in tag at line {ex.Start.Line}, col {ex.Start.Column}\", ex); }","preventionTips":["Re-encode tags from a managed string with Uri.EscapeDataString so sequences are always complete.","Validate files after any byte-level transformation (FTP ASCII mode, old editors, encodings).","Use ASCII-only tag names in configuration you control."],"tags":["yaml","utf8","encoding"],"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"}