floci-io/floci · error · CoercingParseValueException
AWSShort out of range: {}
Error message
AWSShort out of range: {} What it means
Thrown by the AWSShort scalar's parseValue when the integer, after conversion, falls outside the 16-bit signed range [-32768, 32767]. The scalar first coerces the input to an int (accepting numbers or numeric strings), then enforces the short range explicitly.
Source
Thrown at src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java:353
})
.build();
public static final GraphQLScalarType AWS_SHORT = GraphQLScalarType.newScalar()
.name("AWSShort")
.description("A 16-bit signed integer (-32768 to 32767)")
.coercing(new Coercing<Integer, Integer>() {
@Override
public Integer serialize(Object dataFetcherResult) {
if (dataFetcherResult instanceof Number n) return n.intValue();
return Integer.parseInt(dataFetcherResult.toString());
}
@Override
public Integer parseValue(Object input) {
int val;
if (input instanceof Number n) val = n.intValue();
else val = Integer.parseInt(input.toString());
if (val < -32768 || val > 32767)
throw new CoercingParseValueException("AWSShort out of range: " + val);
return val;
}
@Override
public Integer parseLiteral(Object input) {
if (input instanceof graphql.language.IntValue iv) return parseValue(iv.getValue().intValue());
throw new CoercingParseLiteralException("AWSShort must be an integer");
}
})
.build();
public static final GraphQLScalarType AWS_FLOAT = GraphQLScalarType.newScalar()
.name("AWSFloat")
.description("An IEEE 754 double-precision float")
.coercing(new Coercing<Double, Double>() {
@Override
public Double serialize(Object dataFetcherResult) {
if (dataFetcherResult == null) return null;
if (dataFetcherResult instanceof Number n) return n.doubleValue();View on GitHub (pinned to 62ff490619)
Solutions
- Clamp or range-check the value client-side before sending: -32768 <= v && v <= 32767
- If legit values exceed 32767, widen the schema field to AWSInteger/AWSLong
- Map unsigned-16 sources by down-shifting or validating (< 65536) explicitly
- Add a boundary test for 32767/32768 to catch regressions
Example fix
// before
variables.put("port", 65535); // > 32767 -> throws
// after
if (port < -32768 || port > 32767) throw new IllegalArgumentException("port out of short range");
variables.put("port", port); Defensive patterns
Strategy: validation
Validate before calling
static int toAwsShort(int v) {
if (v < -32768 || v > 32767) throw new IllegalArgumentException("AWSShort out of range: " + v);
return v;
} Type guard
const isAwsShort = (v: number): boolean => Number.isInteger(v) && v >= -32768 && v <= 32767;
Try / catch
catch (CoercingParseValueException e) { // clamp or widen: change schema field to AWSInteger if 32767 is too small } Prevention
- Range-check at the client boundary
- Model client fields with the same width as the schema
- Add boundary tests at 32767/32768 and -32768/-32769
When it happens
Trigger: A GraphQL request sends 65535, -40000, 100000, or "70000" as a variable for a field typed AWSShort.
Common situations: Reusing an int-typed client model field for a schema field declared AWSShort; computed values (counts, quantities, ports above 32767) overflowing the narrow type; porting data from systems using unsigned 16-bit semantics (0-65535); test fixtures using large sentinel numbers.
Related errors
- AWSShort must be an integer
- BadRequestException
- Invalid JSON: {}
- Invalid AWSDateTime: {}
- Invalid AWSDate: {}
AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14).
Data as JSON: /api/errors/62232862e81836e9.
Report an issue: GitHub.