{"record":{"id":"e4b48d69202b4412","repo":"floci-io/floci","slug":"awsboolean-cannot-parse-non-boolean-value","errorCode":null,"errorMessage":"AWSBoolean cannot parse non-boolean value: {}","messagePattern":"AWSBoolean cannot parse non-boolean value: (.+?)","errorType":"validation","errorClass":"CoercingParseValueException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java","lineNumber":282,"sourceCode":"                return parseValue(sv.getValue());\n            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_BOOLEAN = GraphQLScalarType.newScalar()\n        .name(\"AWSBoolean\")\n        .description(\"A boolean value\")\n        .coercing(new Coercing<Boolean, Boolean>() {\n            @Override\n            public Boolean serialize(Object dataFetcherResult) {\n                if (dataFetcherResult == null) return null;\n                if (dataFetcherResult instanceof Boolean b) return b;\n                throw new CoercingSerializeException(\"AWSBoolean cannot serialize non-boolean value: \" + dataFetcherResult.getClass().getSimpleName());\n            }\n            @Override\n            public Boolean parseValue(Object input) {\n                if (input instanceof Boolean b) return b;\n                throw new CoercingParseValueException(\"AWSBoolean cannot parse non-boolean value: \" + input);\n            }\n            @Override\n            public Boolean parseLiteral(Object input) {\n                if (input instanceof graphql.language.BooleanValue bv) return bv.isValue();\n                throw new CoercingParseLiteralException(\"AWSBoolean must be a boolean literal\");\n            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_LONG = GraphQLScalarType.newScalar()\n        .name(\"AWSLong\")\n        .description(\"A 64-bit signed integer\")\n        .coercing(new Coercing<Long, Long>() {\n            @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());","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java#L264-L300","documentation":"Thrown by the AWSBoolean scalar's parseValue when an incoming variable value for an AWSBoolean field is not a java.lang Boolean. Variables arrive as parsed JSON, so a JSON string \"true\" or number 1 does not satisfy the instanceof check and the strict scalar rejects it instead of coercing.","triggerScenarios":"A GraphQL request passes variables {\"flag\": \"true\"} or {\"flag\": 1} or {\"flag\": \"yes\"} where the schema declares $flag: AWSBoolean — the JSON value is a string/number, not a boolean.","commonSituations":"Client code building variables from form inputs or query strings where everything is a string; Templates/ENV-driven config interpolated as strings (\"true\" instead of true); Language serializers that encode booleans as 0/1 or \"Y\"/\"N\" by convention; Test fixtures written by hand with quoted booleans.","solutions":["Send a real JSON boolean: variables {\"flag\": true} — unquoted","When building from strings, convert first: Boolean.parseBoolean(s)","Fix hand-written JSON fixtures: search for \\\"true\\\" / \\\"false\\\" near AWSBoolean fields","Add a client-side type check on the variables map before dispatch"],"exampleFix":"// before\nvariables.put(\"flag\", request.getParameter(\"flag\")); // \"true\" string -> throws\n\n// after\nvariables.put(\"flag\", Boolean.parseBoolean(request.getParameter(\"flag\"))); // true","handlingStrategy":"type-guard","validationCode":"Object v = variables.get(\"flag\");\nif (!(v instanceof Boolean)) throw new IllegalArgumentException(\"flag must be a JSON boolean (true/false), got: \" + v);","typeGuard":"const isAwsBooleanValue = (v: unknown): v is boolean => typeof v === 'boolean';","tryCatchPattern":"catch (CoercingParseValueException e) { // convert the source string with Boolean.parseBoolean and resend }","preventionTips":["Never quote booleans in variable JSON","Convert form/query params with Boolean.parseBoolean at the boundary","Type-check the variables map in one shared pre-flight step"],"tags":["graphql","appsync","awsboolean","variables","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}