{"record":{"id":"e70dcf34c00eabdc","repo":"floci-io/floci","slug":"invalid-awsbigdecimal","errorCode":null,"errorMessage":"Invalid AWSBigDecimal: {}","messagePattern":"Invalid AWSBigDecimal: (.+?)","errorType":"validation","errorClass":"CoercingParseValueException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java","lineNumber":402,"sourceCode":"            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_BIG_DECIMAL = GraphQLScalarType.newScalar()\n        .name(\"AWSBigDecimal\")\n        .description(\"An arbitrary-precision decimal number\")\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                    new BigDecimal(str);\n                } catch (NumberFormatException e) {\n                    throw new CoercingParseValueException(\"Invalid AWSBigDecimal: \" + str);\n                }\n                return str;\n            }\n            @Override\n            public String parseLiteral(Object input) {\n                if (input instanceof StringValue sv) return parseValue(sv.getValue());\n                if (input instanceof graphql.language.FloatValue fv) return fv.getValue().toString();\n                if (input instanceof graphql.language.IntValue iv) return iv.getValue().toString();\n                return null;\n            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_BIG_INT = GraphQLScalarType.newScalar()\n        .name(\"AWSBigInt\")\n        .description(\"An arbitrary-precision integer\")\n        .coercing(new Coercing<String, String>() {\n            @Override","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java#L384-L420","documentation":"Thrown by the AWSBigDecimal scalar's parseValue when the string cannot construct a java.math.BigDecimal. The scalar is string-based on the wire, so the numeric text must be a valid Java decimal literal (sign, digits, optional decimal point; no exponent-with-suffix forms Java rejects, no currency symbols, no separators).","triggerScenarios":"A GraphQL request sends \"1,234.56\" (thousands separator), \"12.34.56\", \"$9.99\", \"abc\", or \"\" as a variable for a field typed AWSBigDecimal.","commonSituations":"Locale-aware formatting applied before sending (European \"1.234,56\" or US \"1,234.56\"); currency-prefixed prices from UIs; empty strings from optional form fields submitted as \"\" instead of null; exponent notation mismatches from different serializers.","solutions":["Send the raw unformatted numeric string: \"1234.56\" — format for display only, never for transport","Strip currency symbols and separators, or better, never add them: use plain toString of the BigDecimal","For optional fields, send null/omit instead of \"\"","Validate client-side: try { new BigDecimal(s); } catch before sending"],"exampleFix":"// before\nString price = NumberFormat.getNumberInstance(Locale.US).format(bd); // \"1,234.56\" -> throws\n\n// after\nString price = bd.toPlainString(); // \"1234.56\"","handlingStrategy":"validation","validationCode":"static String toAwsBigDecimal(java.math.BigDecimal bd) { return bd.toPlainString(); }\nstatic boolean validAwsBigDecimal(String s) { try { new java.math.BigDecimal(s); return true; } catch (NumberFormatException e) { return false; } }","typeGuard":"const isAwsBigDecimal = (s: string): boolean => /^-?\\d+(\\.\\d+)?$/.test(s.trim());","tryCatchPattern":"catch (CoercingParseValueException e) { // re-format with toPlainString() (no grouping, no symbols) and resend }","preventionTips":["Transport raw numeric strings; format only for display","Never apply locale NumberFormat before sending","Send null (not \"\") for absent values","Validate with new BigDecimal(s) client-side"],"tags":["graphql","appsync","awsbigdecimal","decimal","locale","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}