{"record":{"id":"6ff4172e714722a6","repo":"stride3d/stride","slug":"while-scanning-a-directive-find-uknown-directive-name","errorCode":null,"errorMessage":"While scanning a directive, find uknown directive name.","messagePattern":"While scanning a directive, find uknown directive name\\.","errorType":"exception","errorClass":"SyntaxErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Scanner.cs","lineNumber":745,"sourceCode":"            // Scan the directive name.\n\n            string name = ScanDirectiveName(start);\n\n            // Is it a YAML directive?\n\n            Token directive;\n            switch (name)\n            {\n                case \"YAML\":\n                    directive = ScanVersionDirectiveValue(start);\n                    break;\n\n                case \"TAG\":\n                    directive = ScanTagDirectiveValue(start);\n                    break;\n\n                default:\n                    throw new SyntaxErrorException(start, mark, \"While scanning a directive, find uknown directive name.\");\n            }\n\n            // Eat the rest of the line including any comments.\n\n            while (analyzer.IsBlank())\n            {\n                Skip();\n            }\n\n            if (analyzer.Check('#'))\n            {\n                while (!analyzer.IsBreakOrZero())\n                {\n                    Skip();\n                }\n            }\n\n            // Check if we are at the end of the line.","sourceCodeStart":727,"sourceCodeEnd":763,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Scanner.cs#L727-L763","documentation":"YAML scanner error in ScanDirective: the directive name at the top of the document is neither YAML nor TAG, and unknown directives are rejected. The input file uses an unsupported %DIRECTIVE (e.g. %RESOLVE or a typo).","triggerScenarios":"A line starting with '%NAME ...' where NAME is not YAML or TAG, e.g. '%INCLUDE file.yaml' or a template directive left in the file.","commonSituations":"Mixing preprocessor/template syntax (e.g. other tooling directives) into plain YAML, or typos like '%YML 1.2'.","solutions":["Remove or correct the unknown %directive line at the start of the YAML document","Use only %YAML and %TAG directives, with correct spelling"],"exampleFix":"// before\n%INCLUDE other.yaml\nkey: value\n// after\nkey: value","handlingStrategy":"validation","validationCode":"// Reject any % directive that is not YAML or TAG\nforeach (var line in yamlText.Split('\\n')) { var t = line.TrimStart(); if (t.StartsWith(\"%\") && !t.StartsWith(\"%YAML\") && !t.StartsWith(\"%TAG\")) throw new FormatException(\"Unsupported directive: \" + t); }","typeGuard":null,"tryCatchPattern":"catch (SyntaxErrorException ex) { throw new ConfigFormatException($\"Unknown % directive near {ex.Start.Line}\"); }","preventionTips":["Remember YAML has no %INCLUDE — split/merge files in code instead","Process template directives before YAML parsing","Only %YAML and %TAG are valid directives"],"tags":["yaml","scanner","directive"],"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"}