{"record":{"id":"aec4b49a40a9504a","repo":"stride3d/stride","slug":"mapping-values-are-not-allowed-in-this-context","errorCode":null,"errorMessage":"Mapping values are not allowed in this context.","messagePattern":"Mapping values are not allowed in this context\\.","errorType":"exception","errorClass":"SyntaxErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Scanner.cs","lineNumber":1051,"sourceCode":"                simpleKey.IsPossible = false;\n\n                // A simple key cannot follow another simple key.\n\n                simpleKeyAllowed = false;\n            }\n            else\n            {\n                // The ':' indicator follows a complex key.\n\n                // In the block context, extra checks are required.\n\n                if (flowLevel == 0)\n                {\n                    // Check if we are allowed to start a complex value.\n\n                    if (!simpleKeyAllowed)\n                    {\n                        throw new SyntaxErrorException(mark, mark, \"Mapping values are not allowed in this context.\");\n                    }\n\n                    // Add the BLOCK-MAPPING-START token if needed.\n\n                    RollIndent(mark.Column, -1, false, mark);\n                }\n\n                // Simple keys after ':' are allowed in the block context.\n\n                simpleKeyAllowed = flowLevel == 0;\n            }\n\n            // Consume the token.\n\n            Mark start = mark;\n            Skip();\n\n            // Create the VALUE token and append it to the queue.","sourceCodeStart":1033,"sourceCodeEnd":1069,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Scanner.cs#L1033-L1069","documentation":"A ':' mapping value indicator was found where a complex value is not allowed. This occurs when ':' follows a scalar in block context without that scalar having been a valid simple key (simpleKeyAllowed is false).","triggerScenarios":"A colon appearing after content on the same line where the scanner cannot start a new mapping, e.g. 'a b: c' where 'a b' wasn't recorded as a possible simple key, or ':' after an already-completed value like 'key: v1: v2'.","commonSituations":"Two colons on one line ('key: value: other'), or colons inside unquoted scalars in block context.","solutions":["Quote the scalar containing the colon: \"http://example.com\"","Remove the extra ':' if two key/value pairs were meant to be nested — put the nested mapping on the next line with indentation","Check the reported line for stray ':' characters"],"exampleFix":"// before\nkey: value: other\n// after\nkey:\n  nested: other","handlingStrategy":"validation","validationCode":"// Flag unquoted scalars with multiple colons in block context\nvar lines = yamlText.Split('\\n'); foreach (var l in lines) { var t = l.Trim(); if (t.StartsWith(\"#\")) continue; var first = t.IndexOf(\": \"); if (first >= 0 && t.IndexOf(\": \", first + 1) >= 0 && !t.Contains(\"\\\"\") && !t.Contains(\"'\")) throw new FormatException(\"Unquoted colon in value: \" + l); }","typeGuard":"bool NeedsQuoting(string s) => s.Contains(\": \") || s.TrimEnd().EndsWith(\":\");","tryCatchPattern":"catch (SyntaxErrorException ex) { throw new ConfigFormatException($\"':' misplaced near {ex.Start.Line}:{ex.Start.Column}\"); }","preventionTips":["Quote any value containing ': ' (URLs, times like 12:30)","One key:value pair per line; nest instead of chaining colons","Lint YAML in CI"],"tags":["yaml","scanner","mapping-value"],"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"}