apache/cassandra · error · SyntaxException
Syntax error parsing '%s: for msg unexpected character '%s'
Error message
Syntax error parsing '%s: for msg unexpected character '%s'
What it means
TypeParser.getPartitionerDefinedOrder parses an empty-partition-order type expression of the form 'partitioner(...)'. If, after consuming the parenthesized content, the current character is not the expected ')' (or the input ends unexpectedly), it throws a SyntaxException describing the unexpected character. This indicates a malformed type string in schema/config input.
Source
Thrown at src/java/org/apache/cassandra/db/marshal/TypeParser.java:190
++idx; // skipping '('
skipBlank();
String k = readNextIdentifier();
IPartitioner partitioner = FBUtilities.newPartitioner(k);
skipBlank();
if (str.charAt(idx) == ':')
{
++idx;
skipBlank();
// must be PartitionerDefinedOrder
return partitioner.partitionOrdering(parse());
}
else if (str.charAt(idx) == ')')
{
idx = initIdx;
return partitioner.partitionOrdering(null);
}
throw new SyntaxException("Syntax error parsing '" + str + ": for msg unexpected character '" + str.charAt(idx) + "'");
}
public static String stringifyTKeyValueParameters(Map<String, String> map)
{
StringBuilder sb = new StringBuilder();
sb.append('(');
for (Map.Entry<String, String> e : map.entrySet())
sb.append(e.getKey()).append(" = ").append(e.getValue()).append(", ");
if (!map.isEmpty())
sb.setLength(sb.length() - 2);
return sb.append(')').toString();
}
public Map<String, String> getKeyValueParameters() throws SyntaxException
{
if (isEOS())
return Collections.emptyMap();
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Fix the type string so it reads exactly 'partitioner(...)' with balanced parentheses
- Use a simpler supported type name if the partitioner-defined order isn't required
- Check the exact string being parsed (schema definition, CLI arg) and quote it properly
- Verify version-appropriate syntax for the type expression
Example fix
// before
TypeParser.parse("partitioner(org.apache.cassandra.dht.Murmur3Partitioner"); // missing ')'
// after
TypeParser.parse("partitioner(org.apache.cassandra.dht.Murmur3Partitioner)"); Defensive patterns
Strategy: validation
Validate before calling
String s = typeString.trim();
if (s.startsWith("partitioner(") && !s.endsWith(")"))
throw new IllegalArgumentException("malformed partitioner type expression: " + s); Try / catch
try {
TypeParser.getPartitionerDefinedOrder(str);
} catch (SyntaxException e) {
throw new IllegalArgumentException("bad type string: " + e.getMessage());
} Prevention
- Verify balanced parentheses in type expressions
- Prefer programmatic type construction over hand-written type strings
- Test schema strings through TypeParser before applying them
When it happens
Trigger: Specifying a reverse/ordered comparator string with an unbalanced or misplaced parenthesis (e.g. 'partitioner(bytes' or 'partitioner)x'), typically from a table's comparator option or a CLI argument parsed via TypeParser.
Common situations: Hand-editing cassandra-cli/schema scripts with typos in type expressions; copying type strings across versions with changed syntax; automation generating unbalanced parentheses.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- FrozenType() only accepts one parameter
- ListType takes exactly 1 type parameter
- MapType takes exactly 2 type parameters
- category %s not found in %s
- 'Get CIDR groups for IP' operation not supported by %s
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/02b3ff8545e55c0f.
Report an issue: GitHub.