{"record":{"id":"7b59a67de36a1cbe","repo":"stride3d/stride","slug":"while-scanning-a-block-scalar-find-an-intendation-indicator","errorCode":null,"errorMessage":"While scanning a block scalar, find an intendation indicator equal to 0.","messagePattern":"While scanning a block scalar, find an intendation indicator equal to 0\\.","errorType":"exception","errorClass":"SyntaxErrorException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core.Yaml/Scanner.cs","lineNumber":1342,"sourceCode":"            // Check for a chomping indicator.\n\n            if (analyzer.Check(\"+-\"))\n            {\n                // Set the chomping method and eat the indicator.\n\n                chomping = analyzer.Check('+') ? +1 : -1;\n\n                Skip();\n\n                // Check for an indentation indicator.\n\n                if (analyzer.IsDigit())\n                {\n                    // Check that the intendation is greater than 0.\n\n                    if (analyzer.Check('0'))\n                    {\n                        throw new SyntaxErrorException(start, mark, \"While scanning a block scalar, find an intendation indicator equal to 0.\");\n                    }\n\n                    // Get the intendation level and eat the indicator.\n\n                    increment = analyzer.AsDigit();\n\n                    Skip();\n                }\n            }\n\n            // Do the same as above, but in the opposite order.\n\n            else if (analyzer.IsDigit())\n            {\n                if (analyzer.Check('0'))\n                {\n                    throw new SyntaxErrorException(start, mark, \"While scanning a block scalar, find an intendation indicator equal to 0.\");\n                }","sourceCodeStart":1324,"sourceCodeEnd":1360,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core.Yaml/Scanner.cs#L1324-L1360","documentation":"For block scalars (| and >), an explicit indentation indicator is a single digit following the indicator (e.g. '|2'). YAML forbids 0 as that digit because zero indentation is meaningless, so ScanBlockScalar throws this SyntaxErrorException when it reads a '0' as the indentation indicator in the header (digit-before-chomping order).","triggerScenarios":"A block scalar header like '|0', '>0', '|0-' or '|+0' (digit appearing before the chomping indicator in the source). Any parse of a document containing such a header throws when the scanner processes the block scalar.","commonSituations":"Misunderstanding of the indentation indicator syntax (people write '|0' thinking it means 'auto-detect'), programmatic generation of block scalars with a computed indent of 0, and hand-edited multiline strings in configs.","solutions":["Replace the '0' indicator with a positive digit (1-9), e.g. '|2' instead of '|0'.","If you wanted auto-detected indentation, remove the digit entirely and just use '|' or '>'.","Keep the digit adjacent to '|' or '>' in the header; chomping indicators +/- may follow, e.g. '|2-' or '|+2'.","Fix generator code to clamp the computed indentation indicator to >= 1 or omit it when 0.","Lint the YAML before loading to catch invalid block scalar headers."],"exampleFix":"// before (invalid zero indentation indicator)\ntext: |0\n  line\n\n// after\ntext: |2\n  line","handlingStrategy":"try-catch","validationCode":"static bool HasNoZeroIndentIndicator(string yaml) =>\n    !System.Text.RegularExpressions.Regex.IsMatch(yaml, @\"[|>][0-9]|[|>][+-]?0\");","typeGuard":null,"tryCatchPattern":"try\n{\n    var obj = deserializer.Deserialize<T>(input);\n}\ncatch (YamlException ex)\n{\n    throw new FormatException($\"Invalid block scalar header at {ex.Start.Line}:{ex.Start.Column}: {ex.Message}\", ex);\n}","preventionTips":["Indentation indicators must be 1-9; omit the digit to auto-detect","If generating headers, clamp computed indent to >= 1 or drop the indicator at 0","Remember order: |/> then optional digit and/or +/- chomping (either order)","Grep for '|0' and '>0' patterns in YAML assets as a cheap CI check"],"tags":["yaml","parser","block-scalar"],"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"}