floci-io/floci · error · CoercingParseValueException
Invalid AWSTime: {}
Error message
Invalid AWSTime: {} What it means
Thrown by the AWSTime scalar's parseValue when the string is not a valid ISO-8601 local time. The coercion uses LocalTime.parse with DateTimeFormatter.ISO_LOCAL_TIME, accepting HH:mm:ss with optional fractional seconds (e.g. 12:34:56 or 12:34:56.789) but rejecting offsets, am/pm markers, or missing seconds in some shapes.
Source
Thrown at src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java:125
}
})
.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;
}
@Override
public String parseValue(Object input) {
String str = input.toString();
try {
LocalTime.parse(str, DateTimeFormatter.ISO_LOCAL_TIME);
} catch (DateTimeParseException e) {
throw new CoercingParseValueException("Invalid AWSTime: " + 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_TIMESTAMP = GraphQLScalarType.newScalar()
.name("AWSTimestamp")
.description("Unix epoch seconds (0 to 32503680000)")
.coercing(new Coercing<Long, Long>() {
@Override
public Long serialize(Object dataFetcherResult) {
if (dataFetcherResult == null) return null;View on GitHub (pinned to 62ff490619)
Solutions
- Format with LocalTime.toString() or DateTimeFormatter.ISO_LOCAL_TIME
- Strip any timezone offset before sending — convert the zoned time to a LocalTime in the intended zone
- Use 24-hour clock, zero-padded HH:mm:ss
- Validate client-side: try { LocalTime.parse(s); } catch before sending
Example fix
// before
String t = new SimpleDateFormat("hh:mm a").format(date); // 10:30 AM -> throws
// after
String t = LocalTime.of(10, 30, 0).toString(); // 10:30:00 Defensive patterns
Strategy: validation
Validate before calling
static boolean validAwsTime(String s) { try { LocalTime.parse(s); return true; } catch (DateTimeParseException e) { return false; } }
if (!validAwsTime(t)) throw new IllegalArgumentException("AWSTime must be HH:mm:ss (ISO-8601 local time)"); Type guard
// TS
const isAwsTime = (s: string): boolean => /^\d{2}:\d{2}:\d{2}(\.\d+)?$/.test(s); Try / catch
catch (CoercingParseValueException e) { // flag the time input, require 24h HH:mm:ss } Prevention
- Use LocalTime.toString() or ISO_LOCAL_TIME
- Convert zoned times to LocalTime in the target zone first
- Never include offsets or am/pm markers
- Normalize time-picker output before submit
When it happens
Trigger: A GraphQL request sends "10:30 AM", "10:30:00+02:00" (offset not allowed; that is a different AWS extended time shape), "25:99:00", or "10.30.00" as an AWSTime variable.
Common situations: Frontend time pickers emitting locale strings like "3:05 PM"; carrying a timezone offset into a field typed AWSTime; 12-hour clock formatting from SimpleDateFormat ("hh:mm a"); dropping the seconds component inconsistently.
Related errors
- Invalid AWSDateTime: {}
- Invalid AWSDate: {}
- BadRequestException
- Invalid JSON: {}
- AWSTimestamp out of range: {}
AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14).
Data as JSON: /api/errors/a6f5a465126ed67b.
Report an issue: GitHub.