stride3d/stride · error · SemanticErrorException
While parsing a flow mapping, did not find expected ',' or…
Error message
While parsing a flow mapping, did not find expected ',' or '}'.
What it means
YAML parser error in Parser.ParseFlowMappingKey: inside a flow mapping ({...}), after the first key the next token was neither a comma (FlowEntry) nor the closing brace, so the parser cannot continue the flow mapping. Caused by malformed flow-mapping syntax such as a missing comma between entries or an unexpected token.
Solutions
- Add the missing ',' between flow mapping entries
- Close the mapping with '}' where intended
- Remove stray characters/tokens inside the flow mapping
Example fix
// before
limits: {cpu: 2 memory: 4Gi
// after
limits: {cpu: 2, memory: 4Gi} Defensive patterns
Strategy: validation
Validate before calling
// Reject flow mappings with obviously missing separators before load
var lines = yamlText.Split('\n'); foreach (var l in lines) if (System.Text.RegularExpressions.Regex.IsMatch(l, "\\{[^}]*\\w\\s+\\w+\\s*[^,:}\\n]")) throw new FormatException("Possible missing ',' in flow mapping: " + l); Try / catch
try { yaml.Load(reader); } catch (YamlException ex) { throw new ConfigFormatException($"Flow mapping error at {ex.Start.Line}:{ex.Start.Column}"); } Prevention
- Validate inline JSON-like YAML with a linter
- Prefer block mappings over { } style for config files
- Keep one key/value pair per flow-mapping entry followed by a comma
When it happens
Trigger: A flow mapping like {a: 1 b: 2} (missing comma between pairs), an unclosed '{', or an illegal token inside { ... }.
Common situations: Inline JSON-ish YAML objects in config files where a comma was dropped or the closing '}' was deleted during editing.
Related errors
- While parsing a flow sequence, did not find expected ',' or…
- While parsing a block mapping, did not find expected key.
- Expected ' ', got ' ' (at line , character ).
- Did not find expected <stream-start>.
- Did not find expected
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/ae3f3d53ab431cb3.
Report an issue: GitHub.
Appendix: source
Thrown at sources/core/Stride.Core.Yaml/Parser.cs:894
{
if (isFirst)
{
GetCurrentToken();
Skip();
}
if (!(GetCurrentToken() is FlowMappingEnd))
{
if (!isFirst)
{
if (GetCurrentToken() is FlowEntry)
{
Skip();
}
else
{
var current = GetCurrentToken();
throw new SemanticErrorException(current.Start, current.End, "While parsing a flow mapping, did not find expected ',' or '}'.");
}
}
if (GetCurrentToken() is Key)
{
Skip();
if (!(GetCurrentToken() is Value || GetCurrentToken() is FlowEntry || GetCurrentToken() is FlowMappingEnd))
{
states.Push(ParserState.YAML_PARSE_FLOW_MAPPING_VALUE_STATE);
return ParseNode(false, false);
}
else
{
state = ParserState.YAML_PARSE_FLOW_MAPPING_VALUE_STATE;
return ProcessEmptyScalar(GetCurrentToken().Start);
}
}View on GitHub (pinned to 96fad776d2)