{"record":{"id":"5844abd3796c135b","repo":"quarkusio/quarkus","slug":"directive-skip-was-not-found-in-the-query-on-th","errorCode":null,"errorMessage":"Directive 'skip' was not found in the query (on the server side).","messagePattern":"Directive 'skip' was not found in the query \\(on the server side\\)\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"integration-tests/smallrye-graphql-client/src/main/java/io/quarkus/io/smallrye/graphql/client/LuckyNumbersResource.java","lineNumber":59,"sourceCode":"    public Multi<Integer> primeNumbers() {\n        return Multi.createFrom().items(2, 3, 5, 7, 11, 13);\n    }\n\n    @Query(value = \"echoList\")\n    public List<Integer> echoList(@NonNull List<Integer> list) {\n        return list;\n    }\n\n    @Query\n    public String returnHeader(String key) {\n        return request.getCurrent().request().getHeader(key);\n    }\n\n    @Query\n    public String piNumber() {\n        QueryDirectives directives = context.getDataFetchingEnvironment().getQueryDirectives();\n        if (directives.getImmediateAppliedDirective(\"skip\").isEmpty()) {\n            throw new IllegalArgumentException(\"Directive 'skip' was not found in the query (on the server side).\");\n        }\n\n        return \"3.14159\";\n    }\n\n}\n","sourceCodeStart":41,"sourceCodeEnd":66,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/smallrye-graphql-client/src/main/java/io/quarkus/io/smallrye/graphql/client/LuckyNumbersResource.java#L41-L66","documentation":"This GraphQL server-side query resolver requires the @skip directive to be present on the field being fetched. It reads QueryDirectives from the DataFetchingEnvironment; when getImmediateAppliedDirective(\"skip\") returns empty the resolver throws IllegalArgumentException, meaning the client sent a query without the expected @skip directive.","triggerScenarios":"Querying piNumber without an inline @skip directive on the field, e.g. `{ piNumber }` instead of `{ piNumber @skip(if: false) }`.","commonSituations":"SmallRye GraphQL client integration tests where the client template must include @skip; mismatches after changing the client query and forgetting the directive; older servers not supporting directive introspection.","solutions":["Include @skip in the query sent to the server, e.g. `piNumber @skip(if: false)`","Use the SmallRye GraphQL client query/document builder to add the directive instead of hand-writing the query","Relax the server check if the directive is optional in your API contract"],"exampleFix":"// before\nString query = \"{ piNumber }\";\n// after\nString query = \"{ piNumber @skip(if: false) }\";","handlingStrategy":"validation","validationCode":"String query = \"{ piNumber @skip(if: false) }\";\n// verify directive presence in tests before asserting on the result\n","typeGuard":null,"tryCatchPattern":"try {\n    String pi = client.piNumber();\n} catch (GraphQLClientException e) {\n    if (e.getMessage().contains(\"Directive 'skip' was not found\")) {\n        // fix the query document to include @skip\n    }\n}","preventionTips":["Always build client queries from the server schema/directive definitions","Add a contract test that asserts required directives are present in sent queries","Check server logs for QueryDirectives resolution issues after client query changes"],"tags":["graphql","smallrye","directive","server-side"],"backgroundTag":"missing-graphql-directive","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}