stride3d/stride · error · SyntaxErrorException

While scanning a plain scalar, find a tab character that…

Error message

While scanning a plain scalar, find a tab character that violate intendation.

What it means

Thrown by the YAML Scanner when a tab character is used in the indentation of a plain scalar continuation line. YAML forbids tabs for indentation; after leading blanks, a tab at a column less than the current block indent violates indentation rules and the scanner cannot determine structure.

Solutions

  1. Replace all tab characters used for indentation with spaces (e.g. `expand -t 2 file.yml` or editor 'convert tabs to spaces').
  2. Configure your editor to insert spaces instead of tabs for YAML files (editorconfig: indent_style = space).
  3. Re-run `grep -P '\t' file.yml` to locate remaining tabs and fix them manually.
  4. Normalize the file programmatically before parsing if it comes from an external source.

Example fix

// before (tab-indented)
key:
	value continues
// after
key:
  value continues
Defensive patterns

Strategy: validation

Validate before calling

bool HasTabIndentation(string yaml) => yaml.Split('\n').Any(l => l.Length > 0 && (l[0] == '\t' || l.StartsWith(" \t")));

Try / catch

try
{
    var obj = Deserializer.FromFile(path);
}
catch (SyntaxErrorException ex)
{
    Log.Error(ex, "Tab in indentation at line {Line}", ex.Start.Line);
    File.WriteAllText(path, File.ReadAllText(path).Replace("\t", "  "));
}

Prevention

When it happens

Trigger: Parsing YAML where a continuation line of a multi-line plain scalar begins with (or contains indentation from) a tab character that starts before the current indentation level, e.g. a value line indented with a tab under a block mapping.

Common situations: Files edited in editors configured to insert tabs (default vim/Notepad settings); copy-pasting content from terminals or chat that converted spaces to tabs; build tooling that expands indentation with tabs.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/074f104ed8c13b99. Report an issue: GitHub.

Appendix: source

Thrown at sources/core/Stride.Core.Yaml/Scanner.cs:1917

                // Is it the end?

                if (!(analyzer.IsBlank() || analyzer.IsBreak()))
                {
                    break;
                }

                // Consume blank characters.

                while (analyzer.IsBlank() || analyzer.IsBreak())
                {
                    if (analyzer.IsBlank())
                    {
                        // Check for tab character that abuse intendation.

                        if (hasLeadingBlanks && mark.Column < currentIndent && analyzer.IsTab())
                        {
                            throw new SyntaxErrorException(start, mark, "While scanning a plain scalar, find a tab character that violate intendation.");
                        }

                        // Consume a space or a tab character.

                        if (!hasLeadingBlanks)
                        {
                            whitespaces.Append(ReadCurrentCharacter());
                        }
                        else
                        {
                            Skip();
                        }
                    }
                    else
                    {
                        // Check if it is a first line break.

                        if (!hasLeadingBlanks)

View on GitHub (pinned to 96fad776d2)