{"record":{"id":"b46e088b717f6984","repo":"stride3d/stride","slug":"while-scanning-a-simple-key-could-not-find-expected","errorCode":null,"errorMessage":"While scanning a simple key, could not find expected ':'.","messagePattern":"While scanning a simple key, could not find expected ':'\\.","errorType":"exception","errorClass":"SyntaxErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Scanner.cs","lineNumber":273,"sourceCode":"        private void StaleSimpleKeys()\n        {\n            // Check for a potential simple key for each flow level.\n\n            foreach (var key in simpleKeys)\n            {\n                // The specification requires that a simple key\n\n                //  - is limited to a single line,\n                //  - is shorter than 1024 characters.\n\n\n                if (key.IsPossible && (key.Mark.Line < mark.Line || key.Mark.Index + 1024 < mark.Index))\n                {\n                    // Check if the potential simple key to be removed is required.\n\n                    if (key.IsRequired)\n                    {\n                        throw new SyntaxErrorException(mark, mark, \"While scanning a simple key, could not find expected ':'.\");\n                    }\n\n                    key.IsPossible = false;\n                }\n            }\n        }\n\n        private void FetchNextToken()\n        {\n            // Check if we just started scanning.  Fetch STREAM-START then.\n\n            if (!streamStartProduced)\n            {\n                FetchStreamStart();\n                return;\n            }\n\n            // Eat whitespaces and comments until we reach the next token.","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Scanner.cs#L255-L291","documentation":"The scanner saw a token that looked like a potential simple key (a scalar that could precede ':') but the ':' never arrived before a line break or the 1024-character limit. When that potential key is required (a mapping key in block context must have a colon), scanning fails with this SyntaxErrorException.","triggerScenarios":"A block-context mapping line where the key scalar is followed by a line break instead of ':', e.g. 'key' alone on a line inside a block mapping, or an extremely long scalar (>1024 chars) with no colon.","commonSituations":"Forgot to type ':' after a key in a config file, a key wrapped onto the next line by copy/paste, or multiline plain scalars accidentally interpreted as keys.","solutions":["Add the missing ':' after the key on the reported line","Ensure the key and its ':' are on the same line","If the scalar is a value not a key, fix indentation so it is not treated as a mapping key","Quote long or multi-line strings and use block scalars (| or >) for values"],"exampleFix":"// before\nconfig:\n  name\n  value: 1\n// after\nconfig:\n  name: myapp\n  value: 1","handlingStrategy":"try-catch","validationCode":"// Ensure every non-comment, non-list line in block context ends with ':' or contains ': '\nforeach (var line in yamlText.Split('\\n')) { var t = line.Trim(); if (t.Length>0 && !t.StartsWith(\"#\") && !t.StartsWith(\"-\") && !t.Contains(':')) throw new FormatException(\"Line lacks key/value colon: \" + line); }","typeGuard":null,"tryCatchPattern":"catch (SyntaxErrorException ex) { throw new ConfigFormatException($\"Missing ':' near {ex.Start.Line}:{ex.Start.Column}\"); }","preventionTips":["Never leave a bare key without a colon in a mapping","Keep key/value on a single line","Use block scalars (| or >) for multi-line strings","Lint YAML in CI before deployment"],"tags":["yaml","scanner","syntax"],"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"}