apache/cassandra · error · InvalidTypeException
Cannot parse varint value from
Error message
Cannot parse varint value from "%s"
What it means
InvalidTypeException from VarintCodec.parse: new BigInteger(value) threw NumberFormatException — the string is not a valid arbitrary-precision integer literal (non-numeric characters, malformed sign, or empty after handling of null/empty/'NULL').
Solutions
- Supply a plain optionally-signed decimal integer literal (digits only, no exponent or separators)
- Strip whitespace, quotes, or locale formatting from the value
- Use a value within the intended range and re-check the string encoding of the source data
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java:2067 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/79c2feb31814f4a1.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java:2067
private static final VarintCodec instance = new VarintCodec();
private VarintCodec()
{
super(DataType.varint(), BigInteger.class);
}
@Override
public BigInteger parse(String value)
{
try
{
return value == null || value.isEmpty() || value.equalsIgnoreCase("NULL")
? null
: new BigInteger(value);
}
catch (NumberFormatException e)
{
throw new InvalidTypeException(
String.format("Cannot parse varint value from \"%s\"", value), e);
}
}
@Override
public String format(BigInteger value)
{
if (value == null) return "NULL";
return value.toString();
}
@Override
public ByteBuffer serialize(BigInteger value, ProtocolVersion protocolVersion)
{
return value == null ? null : ByteBuffer.wrap(value.toByteArray());
}
@OverrideView on GitHub (pinned to 88fd0f6a0e)