stride3d/stride · error · SemanticErrorException
While parsing a node, did not find expected node content.
Error message
While parsing a node, did not find expected node content.
What it means
ParseNode reached a point where it expected actual node content (scalar, sequence start, mapping start, or an alias) but found an unexpected token. The parser cannot build any node from what it saw, so it raises SemanticErrorException at the token's span.
Solutions
- Fix the unbalanced or stray bracket/brace at the reported line
- Validate the file with a YAML linter/parser before loading
- Check for truncated or merge-conflict-corrupted content and restore the full document
Example fix
// before list: [a, b, ] extra: } // after list: [a, b] extra: value
Defensive patterns
Strategy: try-catch
Validate before calling
// cheap pre-check for stray closers before a node position
if (Regex.IsMatch(text, @":\s*[\]}\]]")) throw new InvalidDataException("Possible stray closing bracket after ':'"); Try / catch
try { stream.Load(reader); } catch (SemanticErrorException ex) { throw new YamlConfigException($"YAML syntax error near {ex.Start}: {ex.Message}", ex); } Prevention
- Lint YAML in CI before deploying configs
- Watch for truncated writes / merge-conflict markers
- Balance-check brackets when hand-editing
When it happens
Trigger: Malformed constructs like "key: ]" or "key: }" where a node is expected, an empty node position inside a flow collection like "[a, ]" depending on token state, or truncated YAML ending mid-structure.
Common situations: Hand-edited YAML with an unbalanced bracket/brace, merge-conflict markers or truncated files left by failed writes, generating YAML with a template that emits stray closers.
Related errors
- Did not find expected <stream-start>.
- Did not find expected
- While parsing a block collection, did not find expected '-'…
- Expected ' ', got ' ' (at line , character ).
- While parsing a node, find undefined tag handle.
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/0686c4c85aed15a4.
Report an issue: GitHub.
Appendix: source
Thrown at sources/core/Stride.Core.Yaml/Parser.cs:561
return new Events.SequenceStart(anchorName, tagName, isImplicit, DataStyle.Normal, start, blockSequenceStart.End);
}
BlockMappingStart blockMappingStart = GetCurrentToken() as BlockMappingStart;
if (blockMappingStart != null)
{
state = ParserState.YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE;
return new Events.MappingStart(anchorName, tagName, isImplicit, DataStyle.Normal, start, GetCurrentToken().End);
}
}
if (anchorName != null || tag != null)
{
state = states.Pop();
return new Events.Scalar(anchorName, tagName, string.Empty, ScalarStyle.Plain, isImplicit, false, start, GetCurrentToken().End);
}
var current = GetCurrentToken();
throw new SemanticErrorException(current.Start, current.End, "While parsing a node, did not find expected node content.");
}
}
/// <summary>
/// Parse the productions:
/// implicit_document ::= block_node DOCUMENT-END*
/// *************
/// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
/// *************
/// </summary>
private Event ParseDocumentEnd()
{
bool isImplicit = true;
Mark start = GetCurrentToken().Start;
Mark end = start;
if (GetCurrentToken() is DocumentEnd)
{View on GitHub (pinned to 96fad776d2)