{"record":{"id":"3df8ee8534f56708","repo":"stride3d/stride","slug":"mapping-keys-are-not-allowed-in-this-context","errorCode":null,"errorMessage":"Mapping keys are not allowed in this context.","messagePattern":"Mapping keys are not allowed in this context\\.","errorType":"exception","errorClass":"SyntaxErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Scanner.cs","lineNumber":986,"sourceCode":"            // Create the BLOCK-ENTRY token and append it to the queue.\n\n            tokens.Enqueue(new BlockEntry(start, mark));\n        }\n\n        /// <summary>\n        /// Produce the KEY token.\n        /// </summary>\n        private void FetchKey()\n        {\n            // In the block context, additional checks are required.\n\n            if (flowLevel == 0)\n            {\n                // Check if we are allowed to start a new key (not nessesary simple).\n\n                if (!simpleKeyAllowed)\n                {\n                    throw new SyntaxErrorException(mark, mark, \"Mapping keys 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            // Reset any potential simple keys on the current flow level.\n\n            RemoveSimpleKey();\n\n            // Simple keys are allowed after '?' in the block context.\n\n            simpleKeyAllowed = flowLevel == 0;\n\n            // Consume the token.\n\n            Mark start = mark;","sourceCodeStart":968,"sourceCodeEnd":1004,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Scanner.cs#L968-L1004","documentation":"YAML scanner error in FetchKey: a KEY token ('?...' or an implicit mapping key) appears in block context where simple keys are not currently allowed — typically a mapping key appearing after a value on the same line or inside a sequence item, i.e. a key placed where the grammar forbids it.","triggerScenarios":"A '? key' construct appearing after a scalar on the same line or inside a context where the scanner has already consumed a node, e.g. 'a: 1 ? b'.","commonSituations":"Using explicit complex-key syntax ('? {a: 1}\\n: value') in the wrong position, or stray '?' characters left from editing nested mappings.","solutions":["Move the key to its own line at the correct indentation level","Fix block/sequence structure so keys only appear inside mappings","Replace '? ' explicit-key syntax misuse with plain mapping syntax"],"exampleFix":"// before\na: 1 ? b: 2\n// after\n? [a, b]\n: value","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (SyntaxErrorException ex) { throw new ConfigFormatException($\"'?' key indicator misplaced near {ex.Start.Line}:{ex.Start.Column}\"); }","preventionTips":["Avoid explicit '? key' syntax; use simple 'key:' mappings","Quote '?' inside scalars if it is literal content","Place complex-key constructs alone on their lines"],"tags":["yaml","scanner","mapping-key"],"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-16T04:17:20.429Z"}