{"record":{"id":"cc6b49874b72ad95","repo":"hasura/graphql-engine","slug":"no-fields-are-selected","errorCode":null,"errorMessage":"no fields are selected","messagePattern":"no fields are selected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/lang-graphql/src/validation/error.rs","lineNumber":186,"sourceCode":"        argument_name: ast::Name,\n    },\n    #[error(\n        \"argument {argument_name} on field {field_name} of type {type_name} is defined more than once\"\n    )]\n    DuplicateArguments {\n        type_name: ast::TypeName,\n        field_name: ast::Name,\n        argument_name: ast::Name,\n    },\n    #[error(\n        \"required argument {argument_name} not found on field {field_name} of type {type_name}\"\n    )]\n    RequiredArgumentNotFound {\n        type_name: ast::TypeName,\n        field_name: ast::Name,\n        argument_name: ast::Name,\n    },\n    #[error(\"no fields are selected\")]\n    FieldSelectionSetIsEmpty,\n}\n","sourceCodeStart":168,"sourceCodeEnd":189,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/lang-graphql/src/validation/error.rs#L168-L189","documentation":"Error returned by normalize_selection_sets (selection_set.rs:141) when a selection set for a field or operation contains no actual field selections — for example a set consisting only of fragments that resolve to nothing, or `field { }` with an empty braces block. GraphQL requires at least one field in every selection set.","triggerScenarios":"A query or nested field with an empty selection set `{ }`, or a selection set whose fragments/__typename-only content normalizes to zero fields, hits `Err(Error::FieldSelectionSetIsEmpty)` during normalize_selection_sets.","commonSituations":"Programmatic query construction that emits empty braces when a list of subfields is empty, templates with optional subselections, or fragments that don't match the type and get filtered out.","solutions":["Add at least one concrete subfield inside the empty `{ }` block","If building queries programmatically, skip emitting the field entirely when the subfield list is empty","Ensure fragments referenced in the set actually apply to the parent type"],"exampleFix":"# before\nquery { user { posts { } } }\n# after\nquery { user { posts { id } } }","handlingStrategy":"validation","validationCode":"// When building selections programmatically, require at least one subfield\nfn build_field(name: &str, subs: &[Field]) -> String {\n    assert!(!subs.is_empty(), \"selection set must not be empty\");\n    format!(\"{name} {{ {} }}\", subs.iter().map(to_string).collect::<Vec<_>>().join(\" \"))\n}","typeGuard":null,"tryCatchPattern":"// Catch Error::FieldSelectionSetIsEmpty during normalize_selection_sets and reject the generated query before execution","preventionTips":["Never emit `{ }` blocks from query builders","Lint generated queries for empty selection sets"],"tags":["graphql","validation","selection-set","empty-selection"],"backgroundTag":"graphql-empty-selection-set","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}