{"record":{"id":"c4a0b055a245f6e5","repo":"stride3d/stride","slug":"found-incompatible-yaml-document","errorCode":null,"errorMessage":"Found incompatible YAML document.","messagePattern":"Found incompatible YAML document\\.","errorType":"exception","errorClass":"SemanticErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Parser.cs","lineNumber":324,"sourceCode":"        private VersionDirective ProcessDirectives(TagDirectiveCollection tags)\n        {\n            VersionDirective version = null;\n\n            while (true)\n            {\n                VersionDirective currentVersion;\n                TagDirective tag;\n\n                if ((currentVersion = GetCurrentToken() as VersionDirective) != null)\n                {\n                    if (version != null)\n                    {\n                        throw new SemanticErrorException(currentVersion.Start, currentVersion.End, \"Found duplicate %YAML directive.\");\n                    }\n\n                    if (currentVersion.Version.Major != Constants.MajorVersion || currentVersion.Version.Minor != Constants.MinorVersion)\n                    {\n                        throw new SemanticErrorException(currentVersion.Start, currentVersion.End, \"Found incompatible YAML document.\");\n                    }\n\n                    version = currentVersion;\n                }\n                else if ((tag = GetCurrentToken() as TagDirective) != null)\n                {\n                    if (tagDirectives.Contains(tag.Handle))\n                    {\n                        throw new SemanticErrorException(tag.Start, tag.End, \"Found duplicate %TAG directive.\");\n                    }\n                    tagDirectives.Add(tag);\n                    if (tags != null)\n                    {\n                        tags.Add(tag);\n                    }\n                }\n                else\n                {","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Parser.cs#L306-L342","documentation":"The library only supports the YAML version it was built against (Constants.MajorVersion/MinorVersion, i.e. 1.1). A %YAML directive announcing a different major/minor version makes the document incompatible and a SemanticErrorException is thrown at the directive's span.","triggerScenarios":"A document containing \"%YAML 1.2\" (or any version other than 1.1) parsed by this library.","commonSituations":"Configs authored for YAML 1.2 parsers, tools that stamp %YAML 1.2 into their output, migrating configs between YAML libraries.","solutions":["Change the directive to %YAML 1.1","Remove the %YAML line entirely — the parser then assumes its supported version","Rewrite any 1.2-specific syntax (e.g. certain merge/sexagesimal behaviors) that differs from 1.1"],"exampleFix":"// before\n%YAML 1.2\n---\nkey: value\n// after\n%YAML 1.1\n---\nkey: value","handlingStrategy":"validation","validationCode":"foreach (var line in File.ReadLines(path))\n    if (line.TrimStart().StartsWith(\"%YAML \") && !line.Contains(\"1.1\"))\n        throw new UnsupportedYamlVersionException(line);","typeGuard":null,"tryCatchPattern":"try { stream.Load(reader); } catch (SemanticErrorException ex) when (ex.Message.Contains(\"incompatible\")) { throw new YamlConfigException(\"Only YAML 1.1 is supported by this library\", ex); }","preventionTips":["Pin configs to %YAML 1.1 or omit the directive","Check library's supported version (Constants.MajorVersion/MinorVersion) before adopting 1.2 syntax","Rewrite 1.2-only constructs when migrating"],"tags":["yaml","version","directive","incompatible"],"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"}