floci-io/floci · error · CoercingParseValueException
Invalid AWSDate: {}
Error message
Invalid AWSDate: {} What it means
Thrown by the AWSDate scalar's parseValue when the string does not match the strict yyyy-MM-dd ISO-8601 local-date format. The coercion uses LocalDate.parse with DateTimeFormatter.ISO_LOCAL_DATE, so anything other than a plain calendar date (no time, no offset, no slashes) fails.
Source
Thrown at src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java:99
}
})
.build();
public static final GraphQLScalarType AWS_DATE = GraphQLScalarType.newScalar()
.name("AWSDate")
.description("An ISO-8601 date string (yyyy-MM-dd)")
.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 {
LocalDate.parse(str, DateTimeFormatter.ISO_LOCAL_DATE);
} catch (DateTimeParseException e) {
throw new CoercingParseValueException("Invalid AWSDate: " + str);
}
return str;
}
@Override
public String parseLiteral(Object input) {
if (!(input instanceof StringValue sv)) return null;
return parseValue(sv.getValue());
}
})
.build();
public static final GraphQLScalarType AWS_TIME = GraphQLScalarType.newScalar()
.name("AWSTime")
.description("An ISO-8601 time string (HH:mm:ss)")
.coercing(new Coercing<String, String>() {
@Override
public String serialize(Object dataFetcherResult) {
return dataFetcherResult != null ? dataFetcherResult.toString() : null;View on GitHub (pinned to 62ff490619)
Solutions
- Format with LocalDate.toString() or DateTimeFormatter.ISO_LOCAL_DATE / ISO_LOCAL_DATE.format(date)
- Zero-pad month and day: 2024-01-05 not 2024-1-5
- Do not append time or timezone to AWSDate fields
- Validate client-side: try { LocalDate.parse(s); } catch before sending
Example fix
// before
String d = new SimpleDateFormat("MM/dd/yyyy").format(date); // 01/15/2024 -> throws
// after
String d = LocalDate.ofInstant(date.toInstant(), ZoneOffset.UTC).toString(); // 2024-01-15 Defensive patterns
Strategy: validation
Validate before calling
static boolean validAwsDate(String s) { try { LocalDate.parse(s); return true; } catch (DateTimeParseException e) { return false; } }
if (!validAwsDate(d)) throw new IllegalArgumentException("AWSDate must be yyyy-MM-dd"); Type guard
// TS
const isAwsDate = (s: string): boolean => /^\d{4}-\d{2}-\d{2}$/.test(s) && !isNaN(Date.parse(s)); Try / catch
catch (CoercingParseValueException e) { // re-prompt user with yyyy-MM-dd format requirement } Prevention
- Use LocalDate.toString() — it is already ISO
- Zero-pad month and day
- Never send time or offset parts in AWSDate fields
- Centralize date formatting in one client helper
When it happens
Trigger: A GraphQL request sends "2024/01/15", "2024-1-5" (non-padded), "2024-01-15T00:00:00Z" (that is AWSDateTime, not AWSDate), or "15-01-2024" as an AWSDate variable.
Common situations: US or EU locale formatters producing MM/dd/yyyy or dd/MM/yyyy; single-digit month/day not zero-padded; accidentally reusing an AWSDateTime-formatted value for an AWSDate field; frontend date pickers emitting localized strings.
Related errors
- Invalid AWSDateTime: {}
- Invalid AWSTime: {}
- BadRequestException
- Invalid JSON: {}
- AWSTimestamp out of range: {}
AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14).
Data as JSON: /api/errors/b4863c4c50382e3c.
Report an issue: GitHub.