{"record":{"id":"0e008fdb1ae1c33b","repo":"Humanizr/Humanizer","slug":"unexpected-indentation-on-line-line-linenumber","errorCode":null,"errorMessage":"Unexpected indentation on line {line.LineNumber}.","messagePattern":"Unexpected indentation on line (.+?)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs","lineNumber":1440,"sourceCode":"        static SimpleYamlSequence ParseSequence(\n            IReadOnlyList<LineInfo> lines,\n            ref int index,\n            int indent,\n            bool rejectDuplicateKeys)\n        {\n            var items = ImmutableArray.CreateBuilder<SimpleYamlValue>();\n\n            while (index < lines.Count)\n            {\n                var line = lines[index];\n                if (line.Indent < indent)\n                {\n                    break;\n                }\n\n                if (line.Indent != indent)\n                {\n                    throw new InvalidOperationException($\"Unexpected indentation on line {line.LineNumber}.\");\n                }\n\n                if (!IsSequenceItem(line.Content))\n                {\n                    break;\n                }\n\n                var remainder = line.Content.Length == 1\n                    ? string.Empty\n                    : line.Content.Substring(2).TrimStart();\n                index++;\n\n                if (remainder.Length == 0)\n                {\n                    items.Add(ParseBlock(lines, ref index, indent + 2, rejectDuplicateKeys));\n                    continue;\n                }\n","sourceCodeStart":1422,"sourceCodeEnd":1458,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs#L1422-L1458","documentation":"Within a YAML sequence block, every item line must sit at exactly the sequence's indent level. If a line's indent is greater than the sequence indent (but not less, which would simply end the sequence), the parser cannot assign it to any item and rejects it as structurally ambiguous.","triggerScenarios":"A sequence item or its continuation content is indented inconsistently — for example items at 2 spaces but one item's content at 5 spaces, or a sibling mapping key placed inside a sequence scope at the wrong depth.","commonSituations":"Indentation drift within multi-line sequence items; mixed indent widths; pasting content from a differently-indented source into a sequence block.","solutions":["Align all sequence item lines ('- ') to the same even indent column.","Ensure continuation content under a sequence item is indented exactly 2 spaces deeper than the item marker.","Use the line number in the message to locate and fix the misaligned line."],"exampleFix":"# before — inconsistent item indent\nheadings:\n  full:\n    - January\n     - February\n\n# after — uniform item indent\nheadings:\n  full:\n    - January\n    - February","handlingStrategy":"validation","validationCode":"# A standard YAML parser catches inconsistent sequence indentation.\nimport yaml, pathlib\nlocales_dir = pathlib.Path('src/Humanizer/Locales')\nfor f in locales_dir.rglob('*.yml'):\n    try:\n        yaml.safe_load(f.read_text())\n    except yaml.YAMLError as e:\n        print(f'{f.name}: YAML indentation error: {e}')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Align all sequence item markers ('- ') to the same column within a block.","Indent continuation content exactly 2 spaces deeper than the item marker.","Run a YAML linter to catch inconsistent indentation before the source generator runs."],"tags":["locale","yaml","source-generator","parser","indentation"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}