stride3d/stride · error · SyntaxErrorException
Block sequence entries are not allowed in this context.
Error message
Block sequence entries are not allowed in this context.
What it means
A '-' block sequence entry indicator was found where a new sequence entry is not permitted. In block context, a '-' entry can only start where a new node may begin; here simpleKeyAllowed is false (e.g. '-' appears after another scalar on the same line).
Solutions
- Put each '- item' on its own line at consistent indentation
- Remove the '-' if the sequence was meant to be inline (use [a, b] flow style instead)
- Ensure the '-' follows a line break or a key ending with ':'
Example fix
// before key: value - next // after key: - value - next
Defensive patterns
Strategy: validation
Validate before calling
// Block sequence entries must start at line beginning after indentation
var lines = yamlText.Split('\n'); foreach (var l in lines) { var idx = l.IndexOf(" - "); if (idx > 0 && l.Substring(0, idx).Trim().Length > 0 && !l.Substring(0, idx).TrimEnd().EndsWith(":")) throw new FormatException("Inline '-' after scalar: " + l); } Try / catch
catch (SyntaxErrorException ex) { throw new ConfigFormatException($"'-' not allowed near {ex.Start.Line}:{ex.Start.Column}"); } Prevention
- Put each '- item' on its own line
- Use flow style [a, b] for inline lists instead of '-'
- Keep indentation consistent for sequence entries
When it happens
Trigger: Writing '- item' on the same line as a previous scalar (e.g. 'key: value - next'), or a '-' appearing after a key without a value separator in a position the scanner disallows.
Common situations: Collapsing list items onto one line in a config file, or converting block style to inline style incorrectly (a '-' inside a flow sequence is invalid).
Related errors
- While parsing a block collection, did not find expected '-'…
- While scanning a simple key, could not find expected ':'.
- While scanning for the next token, find character that…
- While scanning a directive, find uknown directive name.
- While scanning a directive, did not find expected comment…
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/aea230b320d6417b.
Report an issue: GitHub.
Appendix: source
Thrown at sources/core/Stride.Core.Yaml/Scanner.cs:942
// Create the FLOW-ENTRY token and append it to the queue.
tokens.Enqueue(new FlowEntry(start, mark));
}
/// <summary>
/// Produce the BLOCK-ENTRY token.
/// </summary>
private void FetchBlockEntry()
{
// Check if the scanner is in the block context.
if (flowLevel == 0)
{
// Check if we are allowed to start a new entry.
if (!simpleKeyAllowed)
{
throw new SyntaxErrorException(mark, mark, "Block sequence entries are not allowed in this context.");
}
// Add the BLOCK-SEQUENCE-START token if needed.
RollIndent(mark.Column, -1, true, mark);
}
else
{
// It is an error for the '-' indicator to occur in the flow context,
// but we let the Parser detect and report about it because the Parser
// is able to point to the context.
}
// Reset any potential simple keys on the current flow level.
RemoveSimpleKey();
// Simple keys are allowed after '-'.
View on GitHub (pinned to 96fad776d2)