floci-io/floci · error · AwsException

BadRequestException

BadRequestException

Error message

Invalid schema: " + e.getMessage()

What it means

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.

Source

Thrown at src/main/java/io/github/hectorvent/floci/services/appsync/graphql/AppSyncSchemaParser.java:47

    @Inject
    public AppSyncSchemaParser(AppSyncScalarRegistry scalarRegistry) {
        this.scalarRegistry = scalarRegistry;
    }

    public GraphQLSchema parse(String sdl) {
        String sdlWithDirectives = injectDirectiveDefinitions(sdl);
        validateNoUnknownDirectives(sdl);

        SchemaParser parser = new SchemaParser();
        TypeDefinitionRegistry typeRegistry;
        try {
            typeRegistry = parser.parse(sdlWithDirectives);
        } catch (SchemaProblem e) {
            List<Map<String, Object>> codeErrors = new ArrayList<>();
            for (GraphQLError ge : e.getErrors()) {
                codeErrors.add(toCodeErrorFromGraphQL("PARSER_ERROR", ge));
            }
            throw new AwsException("BadRequestException",
                    "Invalid schema: " + e.getMessage(), 400,
                    buildExtendedData(codeErrors));
        } catch (InvalidSyntaxException e) {
            throw new AwsException("BadRequestException",
                    "Invalid schema: " + e.getMessage(), 400,
                    buildExtendedData(List.of(toCodeError("PARSER_ERROR", e.getMessage(), 0, 0))));
        }

        RuntimeWiring.Builder wiringBuilder = RuntimeWiring.newRuntimeWiring();
        for (var entry : scalarRegistry.scalarMap().entrySet()) {
            wiringBuilder = wiringBuilder.scalar(entry.getValue());
        }

        try {
            return new SchemaGenerator().makeExecutableSchema(typeRegistry, wiringBuilder.build());
        } catch (SchemaProblem e) {
            List<Map<String, Object>> codeErrors = new ArrayList<>();
            for (GraphQLError ge : e.getErrors()) {

View on GitHub (pinned to 62ff490619)

Solutions

  1. Read the extended data errors[] (each has message, line, column) and fix the SDL at the reported location.
  2. Validate the SDL with a local graphql-java/GraphQL parser (or graphql schema linter) before submitting to Floci.
  3. Deduplicate merged type definitions or rename conflicting types before concatenation.

Example fix

# before (duplicate type)
type Item { id: ID! }
type Item { name: String } # PARSER_ERROR: duplicate 'Item'

# after
type Item { id: ID! name: String }
Defensive patterns

Strategy: validation

Validate before calling

import { buildSchema } from 'graphql';
try { buildSchema(sdl); } catch (e) { failFast('Schema has structural errors: ' + e.message); }
// only submit to Floci after local validation passes

Try / catch

catch (BadRequestException e) {
    // e.awsErrorDetails().errorMessage() starts with "Invalid schema:"
    // parse the errors[] extended data for line/column of each PARSER_ERROR and surface them to the author
}

Prevention

When it happens

Trigger: 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.

Common situations: Schema federation/merge tools concatenating schemas with overlapping types; hand-edited SDL introducing duplicates; CI pipelines shipping schema fragments out of order.

Understand the failure class

Background: BadRequestException (HTTP 400) — NestJS 'Bad Request' Errors: Why They Fire and How to Fix Them — this error's family across 4 libraries.

Related errors


AI-assisted analysis of floci-io/floci@62ff490619 (2026-08-14). Data as JSON: /api/errors/14c342bc50760445. Report an issue: GitHub.