ssssssss-team/spider-flow · error · ExpressionError
Expected ':', but got
Error message
Expected ':', but got '<token text>'
What it means
Parser syntax error raised in parseMapLiteral: after parsing a key expression in a {key: value} map literal, stream.expect(':') failed because the next token is not a colon. The input at fault is the map-literal source text — e.g. {a b} or {a = 1} — missing the required ':' between key and value. Since parseMapLiteral is reached from parseAccessOrCallOrLiteral, any expression starting with '{' takes this path.
Solutions
- Add the missing ':' between each key and value in the map literal, e.g. {'name': 'x'}.
- Check the expression for a stray comma or omitted value that shifted token alignment.
- Validate the whole expression in an editor/test panel before saving the flow.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at spider-flow-core/src/main/java/org/spiderflow/core/expression/parsing/Parser.java:173 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ssssssss-team/spider-flow@c799cca99c (2026-09-08).
Data as JSON: /api/errors/aa2c7262011c2fc3.
Report an issue: GitHub.
Appendix: source
Thrown at spider-flow-core/src/main/java/org/spiderflow/core/expression/parsing/Parser.java:173
} else {
ExpressionError.error("Expected a variable, field, map, array, function or method call, or literal.", stream);
return null; // not reached
}
}
private static Expression parseMapLiteral (TokenStream stream) {
Span openCurly = stream.expect(TokenType.LeftCurly).getSpan();
List<Token> keys = new ArrayList<>();
List<Expression> values = new ArrayList<>();
while (stream.hasMore() && !stream.match("}", false)) {
if(stream.match(TokenType.StringLiteral, false)){
keys.add(stream.expect(TokenType.StringLiteral));
}else{
keys.add(stream.expect(TokenType.Identifier));
}
stream.expect(":");
values.add(parseExpression(stream));
if (!stream.match("}", false)) stream.expect(TokenType.Comma);
}
Span closeCurly = stream.expect("}").getSpan();
return new MapLiteral(new Span(openCurly, closeCurly), keys, values);
}
private static Expression parseListLiteral (TokenStream stream) {
Span openBracket = stream.expect(TokenType.LeftBracket).getSpan();
List<Expression> values = new ArrayList<>();
while (stream.hasMore() && !stream.match(TokenType.RightBracket, false)) {
values.add(parseExpression(stream));
if (!stream.match(TokenType.RightBracket, false)) stream.expect(TokenType.Comma);
}
Span closeBracket = stream.expect(TokenType.RightBracket).getSpan();
return new ListLiteral(new Span(openBracket, closeBracket), values);
View on GitHub (pinned to c799cca99c)