{"record":{"id":"b4863c4c50382e3c","repo":"floci-io/floci","slug":"invalid-awsdate","errorCode":null,"errorMessage":"Invalid AWSDate: {}","messagePattern":"Invalid AWSDate: (.+?)","errorType":"validation","errorClass":"CoercingParseValueException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java","lineNumber":99,"sourceCode":"            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_DATE = GraphQLScalarType.newScalar()\n        .name(\"AWSDate\")\n        .description(\"An ISO-8601 date string (yyyy-MM-dd)\")\n        .coercing(new Coercing<String, String>() {\n            @Override\n            public String serialize(Object dataFetcherResult) {\n                return dataFetcherResult != null ? dataFetcherResult.toString() : null;\n            }\n            @Override\n            public String parseValue(Object input) {\n                String str = input.toString();\n                try {\n                    LocalDate.parse(str, DateTimeFormatter.ISO_LOCAL_DATE);\n                } catch (DateTimeParseException e) {\n                    throw new CoercingParseValueException(\"Invalid AWSDate: \" + str);\n                }\n                return str;\n            }\n            @Override\n            public String parseLiteral(Object input) {\n                if (!(input instanceof StringValue sv)) return null;\n                return parseValue(sv.getValue());\n            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_TIME = GraphQLScalarType.newScalar()\n        .name(\"AWSTime\")\n        .description(\"An ISO-8601 time string (HH:mm:ss)\") \n        .coercing(new Coercing<String, String>() {\n            @Override\n            public String serialize(Object dataFetcherResult) {\n                return dataFetcherResult != null ? dataFetcherResult.toString() : null;","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java#L81-L117","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nString d = new SimpleDateFormat(\"MM/dd/yyyy\").format(date); // 01/15/2024 -> throws\n\n// after\nString d = LocalDate.ofInstant(date.toInstant(), ZoneOffset.UTC).toString(); // 2024-01-15","handlingStrategy":"validation","validationCode":"static boolean validAwsDate(String s) { try { LocalDate.parse(s); return true; } catch (DateTimeParseException e) { return false; } }\nif (!validAwsDate(d)) throw new IllegalArgumentException(\"AWSDate must be yyyy-MM-dd\");","typeGuard":"// TS\nconst isAwsDate = (s: string): boolean => /^\\d{4}-\\d{2}-\\d{2}$/.test(s) && !isNaN(Date.parse(s));","tryCatchPattern":"catch (CoercingParseValueException e) { // re-prompt user with yyyy-MM-dd format requirement }","preventionTips":["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"],"tags":["graphql","appsync","awsdate","iso-8601","date","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}