{"record":{"id":"14c342bc50760445","repo":"floci-io/floci","slug":"badrequestexception-14c342","errorCode":"BadRequestException","errorMessage":"Invalid schema: \" + e.getMessage()","messagePattern":"Invalid schema: \" \\+ e\\.getMessage\\(\\)","errorType":"exception","errorClass":"AwsException","httpStatus":400,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncSchemaParser.java","lineNumber":47,"sourceCode":"    @Inject\n    public AppSyncSchemaParser(AppSyncScalarRegistry scalarRegistry) {\n        this.scalarRegistry = scalarRegistry;\n    }\n\n    public GraphQLSchema parse(String sdl) {\n        String sdlWithDirectives = injectDirectiveDefinitions(sdl);\n        validateNoUnknownDirectives(sdl);\n\n        SchemaParser parser = new SchemaParser();\n        TypeDefinitionRegistry typeRegistry;\n        try {\n            typeRegistry = parser.parse(sdlWithDirectives);\n        } catch (SchemaProblem e) {\n            List<Map<String, Object>> codeErrors = new ArrayList<>();\n            for (GraphQLError ge : e.getErrors()) {\n                codeErrors.add(toCodeErrorFromGraphQL(\"PARSER_ERROR\", ge));\n            }\n            throw new AwsException(\"BadRequestException\",\n                    \"Invalid schema: \" + e.getMessage(), 400,\n                    buildExtendedData(codeErrors));\n        } catch (InvalidSyntaxException e) {\n            throw new AwsException(\"BadRequestException\",\n                    \"Invalid schema: \" + e.getMessage(), 400,\n                    buildExtendedData(List.of(toCodeError(\"PARSER_ERROR\", e.getMessage(), 0, 0))));\n        }\n\n        RuntimeWiring.Builder wiringBuilder = RuntimeWiring.newRuntimeWiring();\n        for (var entry : scalarRegistry.scalarMap().entrySet()) {\n            wiringBuilder = wiringBuilder.scalar(entry.getValue());\n        }\n\n        try {\n            return new SchemaGenerator().makeExecutableSchema(typeRegistry, wiringBuilder.build());\n        } catch (SchemaProblem e) {\n            List<Map<String, Object>> codeErrors = new ArrayList<>();\n            for (GraphQLError ge : e.getErrors()) {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncSchemaParser.java#L29-L65","documentation":"Floci's AppSyncSchemaParser failed to turn the submitted SDL into a type registry — graphql-java's SchemaParser reported structural problems (SchemaProblem, e.g. duplicate type names, redefined fields, unknown type references in the base parse). The HTTP 400 BadRequestException carries the graphql-java message plus extended data listing each error with errorType PARSER_ERROR and source locations, mirroring AppSync's CreateApi/UpdateSchema rejection shape.","triggerScenarios":"CreateGraphqlApi with a definitionSchemaDefinition containing duplicate type definitions, a type extending an undefined type, or invalid field syntax. The response's errors[] array under the BadRequestException details each PARSER_ERROR with line/column.","commonSituations":"Schema federation/merge tools concatenating schemas with overlapping types; hand-edited SDL introducing duplicates; CI pipelines shipping schema fragments out of order.","solutions":["Read the extended data errors[] (each has message, line, column) and fix the SDL at the reported location.","Validate the SDL with a local graphql-java/GraphQL parser (or graphql schema linter) before submitting to Floci.","Deduplicate merged type definitions or rename conflicting types before concatenation."],"exampleFix":"# before (duplicate type)\ntype Item { id: ID! }\ntype Item { name: String } # PARSER_ERROR: duplicate 'Item'\n\n# after\ntype Item { id: ID! name: String }","handlingStrategy":"validation","validationCode":"import { buildSchema } from 'graphql';\ntry { buildSchema(sdl); } catch (e) { failFast('Schema has structural errors: ' + e.message); }\n// only submit to Floci after local validation passes","typeGuard":null,"tryCatchPattern":"catch (BadRequestException e) {\n    // e.awsErrorDetails().errorMessage() starts with \"Invalid schema:\"\n    // parse the errors[] extended data for line/column of each PARSER_ERROR and surface them to the author\n}","preventionTips":["Validate SDL in CI with a real GraphQL parser before any Floci/AWS deploy step.","When merging schema files, deduplicate type names programmatically.","Treat parser errors as build failures, not runtime incidents."],"tags":["appsync","graphql","schema","sdl","parser-error"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}