{"record":{"id":"ab88ad620a63a35a","repo":"hasura/graphql-engine","slug":"the-fieldname-for-offsetinput-needs-to-be-defined","errorCode":null,"errorMessage":"the fieldName for offsetInput needs to be defined in GraphqlConfig, when models have a selectMany graphql API","messagePattern":"the fieldName for offsetInput needs to be defined in GraphqlConfig, when models have a selectMany graphql API","errorType":"validation","errorClass":"GraphqlConfigError","httpStatus":null,"severity":"error","filePath":"v3/crates/metadata-resolve/src/stages/graphql_config/error.rs","lineNumber":15,"sourceCode":"use graphql_types as ast;\n\nuse crate::types::error::ContextualError;\n\n#[derive(Debug, thiserror::Error)]\npub enum GraphqlConfigError {\n    #[error(\"graphql configuration is not defined in supergraph\")]\n    MissingGraphqlConfig,\n    #[error(\"graphql configuration should be defined only once in supergraph\")]\n    MultipleGraphqlConfigDefinition,\n    #[error(\n        \"the fieldName for limitInput needs to be defined in GraphqlConfig, when models have a selectMany graphql API\"\n    )]\n    MissingLimitFieldInGraphqlConfig,\n    #[error(\n        \"the fieldName for offsetInput needs to be defined in GraphqlConfig, when models have a selectMany graphql API\"\n    )]\n    MissingOffsetFieldInGraphqlConfig,\n    #[error(\n        \"the filterInput needs to be defined in GraphqlConfig, when models have filterExpressionType\"\n    )]\n    MissingFilterInputFieldInGraphqlConfig,\n    #[error(\n        \"the orderByInput needs to be defined in GraphqlConfig, when models have orderByExpressionType\"\n    )]\n    MissingOrderByInputFieldInGraphqlConfig,\n    #[error(\n        \"the orderByInput.enumTypeNames needs to be defined in GraphqlConfig, when models have orderByExpressionType\"\n    )]\n    MissingOrderByEnumTypeNamesInGraphqlConfig,\n    #[error(\n        \"only one enumTypeNames can be defined in GraphqlConfig, whose direction values are both 'asc' and 'desc'.\"\n    )]","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/metadata-resolve/src/stages/graphql_config/error.rs#L1-L33","documentation":"Raised when a model exposes a `selectMany` GraphQL API but the GraphqlConfig does not define the `offsetInput` fieldName. Offset pagination for list queries requires this argument name to be declared. Thrown during the graphql_config metadata resolution stage.","triggerScenarios":"Metadata contains a model with a selectMany GraphQL API and the GraphqlConfig has no `offsetInput` entry (or no fieldName within it); resolution/validation then fails.","commonSituations":"Same-family authoring mistakes as the limitInput variant: enabling selectMany without completing pagination config, migrating older metadata, or hand-writing config and forgetting the offset half.","solutions":["Add `offsetInput: {fieldName: \"offset\"}` to the GraphqlConfig","Pair it with limitInput — selectMany requires both, so add limitInput too if also missing","Regenerate metadata with current tooling"],"exampleFix":"// before\n{\"graphql\": {\"limitInput\": {\"fieldName\": \"limit\"}}}\n// after\n{\"graphql\": {\"limitInput\": {\"fieldName\": \"limit\"}, \"offsetInput\": {\"fieldName\": \"offset\"}}}","handlingStrategy":"validation","validationCode":"let needs_offset = models.iter().any(|m| m.has_select_many());\nif needs_offset {\n    assert!(config.offset_input.as_ref().is_some_and(|o| o.field_name.is_some()));\n}","typeGuard":"fn offset_ok(config: &GraphqlConfig, needs: bool) -> bool {\n    !needs || config.offset_input.as_ref().is_some_and(|o| o.field_name.is_some())\n}","tryCatchPattern":"Err(GraphqlConfigError::MissingOffsetFieldInGraphqlConfig) => { /* add offsetInput.fieldName and re-resolve */ }","preventionTips":["Treat limit/offset as a pair: add or remove both together","Use current codegen so pagination config is emitted","Validate before resolve"],"tags":["graphql","metadata","pagination","offset","select-many"],"backgroundTag":"missing-graphql-config-field","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}