floci-io/floci · error · CoercingParseValueException
Invalid AWSBigInt: {}
Error message
Invalid AWSBigInt: {} What it means
Thrown by the AWSBigInt scalar's parseValue when the string cannot construct a java.math.BigInteger. The scalar travels as a string on the wire, and the text must be a plain integer literal: optional sign followed by digits, with no decimal point, separators, or whitespace.
Source
Thrown at src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java:430
}
})
.build();
public static final GraphQLScalarType AWS_BIG_INT = GraphQLScalarType.newScalar()
.name("AWSBigInt")
.description("An arbitrary-precision integer")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
try {
new BigInteger(str);
} catch (NumberFormatException e) {
throw new CoercingParseValueException("Invalid AWSBigInt: " + str);
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (input instanceof graphql.language.IntValue iv) return iv.getValue().toString();
if (input instanceof StringValue sv) return parseValue(sv.getValue());
return null;
}
})
.build();
public static final GraphQLScalarType AWS_BYTE = GraphQLScalarType.newScalar()
.name("AWSByte")
.description("A base64-encoded byte array")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {View on GitHub (pinned to 62ff490619)
Solutions
- Convert to integer type before serializing: bd.toBigInteger().toString(), never bd.toString() when the source is decimal
- Strip whitespace and reject non-digit input client-side with your own validation
- Do not use underscore or 0x-prefixed literals in the string
- Validate client-side: try { new BigInteger(s); } catch before sending
Example fix
// before String id = bigDecimalSource.toString(); // "12345678901.0" -> throws // after String id = bigDecimalSource.toBigInteger().toString(); // "12345678901"
Defensive patterns
Strategy: validation
Validate before calling
static String toAwsBigInt(java.math.BigInteger bi) { return bi.toString(); }
static boolean validAwsBigInt(String s) { try { new java.math.BigInteger(s); return true; } catch (NumberFormatException e) { return false; } } Type guard
const isAwsBigInt = (s: string): boolean => /^-?\d+$/.test(s.trim());
Try / catch
catch (CoercingParseValueException e) { // re-serialize from the integer type (toBigInteger) and resend } Prevention
- Serialize from BigInteger, never BigDecimal/double (no trailing .0)
- Strip whitespace and reject underscores/0x prefixes
- Validate with new BigInteger(s) before sending
When it happens
Trigger: A GraphQL request sends "12345678901234567890.0" (decimal point), "1_000_000" (underscores), " 42" (leading space), or "abc" as a variable for a field typed AWSBigInt.
Common situations: Serializing a BigDecimal/double instead of a BigInteger (trailing ".0"); language literals with underscore separators (Java/Rust style) leaking into payloads; whitespace from user input or file parsing; passing hex/octal text like "0x1F".
Related errors
AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14).
Data as JSON: /api/errors/3b2fad7616048cc0.
Report an issue: GitHub.