stride3d/stride · error · SemanticErrorException

While parsing a flow sequence, did not find expected ',' or…

Error message

While parsing a flow sequence, did not find expected ',' or ']'.

What it means

In a flow-style sequence ([a, b, c]), the parser found a token after an entry that is neither a comma separator nor the closing bracket. Flow sequences require entries separated by ',' and terminated by ']'.

Solutions

  1. Check the reported location and insert the missing ',' between flow-sequence entries
  2. Add the missing ']' to close the flow sequence
  3. Ensure no stray characters (e.g. '}' or ']' from another nesting level) appear inside the sequence
  4. Run a YAML linter on the document

Example fix

// before
ports: [80 443
// after
ports: [80, 443]
Defensive patterns

Strategy: validation

Validate before calling

// Balance-check brackets before loading
int depth=0; foreach (var c in yamlText) { if (c=='['||c=='{') depth++; if (c==']'||c=='}') depth--; if (depth<0) throw new FormatException("Unbalanced brackets"); }

Try / catch

try { yaml.Load(reader); } catch (YamlException ex) { throw new ConfigFormatException($"Flow sequence error at {ex.Start.Line}:{ex.Start.Column}"); }

Prevention

When it happens

Trigger: A flow sequence like [a b] (missing comma) or [a, b (unclosed bracket), or an invalid token such as a stray '}' or ':' inside [ ... ].

Common situations: Writing inline arrays in config files (e.g. ports: [80 443]) and forgetting a comma, or truncating the file so the ']' is lost.

Related errors


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

Appendix: source

Thrown at sources/core/Stride.Core.Yaml/Parser.cs:786

            if (isFirst)
            {
                GetCurrentToken();
                Skip();
            }

            Event evt;
            if (!(GetCurrentToken() is FlowSequenceEnd))
            {
                if (!isFirst)
                {
                    if (GetCurrentToken() is FlowEntry)
                    {
                        Skip();
                    }
                    else
                    {
                        var current = GetCurrentToken();
                        throw new SemanticErrorException(current.Start, current.End, "While parsing a flow sequence, did not find expected ',' or ']'.");
                    }
                }

                if (GetCurrentToken() is Key)
                {
                    state = ParserState.YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE;
                    evt = new Events.MappingStart(null, null, true, DataStyle.Compact);
                    Skip();
                    return evt;
                }
                else if (!(GetCurrentToken() is FlowSequenceEnd))
                {
                    states.Push(ParserState.YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE);
                    return ParseNode(false, false);
                }
            }

            state = states.Pop();

View on GitHub (pinned to 96fad776d2)