{"record":{"id":"ff5f6fe415b78036","repo":"floci-io/floci","slug":"awstimestamp-must-be-an-integer","errorCode":null,"errorMessage":"AWSTimestamp must be an integer","messagePattern":"AWSTimestamp must be an integer","errorType":"validation","errorClass":"CoercingParseLiteralException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java","lineNumber":159,"sourceCode":"            @Override\n            public Long serialize(Object dataFetcherResult) {\n                if (dataFetcherResult == null) return null;\n                if (dataFetcherResult instanceof Number n) return n.longValue();\n                return Long.parseLong(dataFetcherResult.toString());\n            }\n            @Override\n            public Long parseValue(Object input) {\n                long val;\n                if (input instanceof Number n) val = n.longValue();\n                else val = Long.parseLong(input.toString());\n                if (val < 0 || val > 32503680000L)\n                    throw new CoercingParseValueException(\"AWSTimestamp out of range: \" + val);\n                return val;\n            }\n            @Override\n            public Long parseLiteral(Object input) {\n                if (input instanceof graphql.language.IntValue iv) return parseValue(iv.getValue().longValue());\n                throw new CoercingParseLiteralException(\"AWSTimestamp must be an integer\");\n            }\n        })\n        .build();\n\n    private static final Pattern EMAIL_PATTERN = Pattern.compile(\"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,}$\");\n\n    public static final GraphQLScalarType AWS_EMAIL = GraphQLScalarType.newScalar()\n        .name(\"AWSEmail\")\n        .description(\"An RFC 5322 email address\")\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                if (!EMAIL_PATTERN.matcher(str).matches())","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java#L141-L177","documentation":"Thrown by the AWSTimestamp scalar's parseLiteral when the GraphQL literal in the query document is not an IntValue. AWSTimestamp must be written as an unquoted integer literal in the query text; strings, floats, booleans, or null literals reach the else branch and this exception.","triggerScenarios":"A query document embeds the value inline as create(x: \"1705315800\") (string literal), create(x: 1705315800.0) (float literal), or create(x: null) instead of the required create(x: 1705315800).","commonSituations":"Template-building query strings and quoting every interpolation out of habit; client code generators that render all variables as strings; passing a float-typed constant into a query literal; using JSON-style null in the document body.","solutions":["Use an unquoted integer literal in the document: 1705315800, not \"1705315800\"","Better: pass the value as a GraphQL $variable of type AWSTimestamp instead of an inline literal","Render numerics without quotes in query builders; only strings get quotes","Double-check generated documents: the AWSTimestamp argument must appear as a bare int"],"exampleFix":"# before\nmutation { create(x: \"1705315800\") }\n\n# after\nmutation Create($x: AWSTimestamp!) { create(x: $x) }\n# variables: {\"x\": 1705315800}","handlingStrategy":"type-guard","validationCode":"// Prefer variables over inline literals; when generating documents, render AWSTimestamp unquoted:\nString doc = \"mutation { create(x: \" + ts + \") }\"; // ts must be a bare long","typeGuard":"const isIntLiteralToken = (v: string | number): boolean => typeof v === 'number' && Number.isInteger(v);","tryCatchPattern":"catch (CoercingParseLiteralException e) { // document is wrong: move the value to a $variable and resend }","preventionTips":["Pass timestamps as GraphQL variables, not inline literals","Never quote numeric literals in generated documents","Add a document lint step: quoted numerics on numeric scalar args are defects"],"tags":["graphql","appsync","awstimestamp","parse-literal","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}