{"record":{"id":"669e8364ea569608","repo":"hasura/graphql-engine","slug":"value-is-not-a-valid-offset-value","errorCode":null,"errorMessage":"{value} is not a valid offset value","messagePattern":"(.+?) is not a valid offset value","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/crates/graphql/ir/src/error.rs","lineNumber":61,"sourceCode":"        decoding_error: String,\n    },\n\n    #[error(\"Unexpected value: expecting {expected_kind:}, but found: {found:}\")]\n    UnexpectedValue {\n        expected_kind: &'static str,\n        found: json::Value,\n    },\n\n    #[error(\"'{name:}' is not a valid GraphQL name.\")]\n    TypeFieldInvalidGraphQlName { name: String },\n\n    #[error(\"'{alias:} is not a valid alias\")]\n    InvalidAlias { alias: String },\n\n    #[error(\"{value} is not a valid limit value\")]\n    InvalidLimitValue { value: u32 },\n\n    #[error(\"{value} is not a valid offset value\")]\n    InvalidOffsetValue { value: u32 },\n\n    #[error(\"field '{field_name:} not found in entity representation\")]\n    FieldNotFoundInEntityRepresentation { field_name: FieldName },\n\n    #[error(\n        \"order_by expects a list of input objects with exactly one key-value pair per input object. Please split the input object with multiple key-value pairs into a list of single key-value pair objects.\"\n    )]\n    OrderByObjectShouldExactlyHaveOneKeyValuePair,\n\n    #[error(\"missing non-nullable argument {argument_name:} for field {field_name:}\")]\n    MissingNonNullableArgument {\n        argument_name: String,\n        field_name: String,\n    },\n\n    #[error(\"Only one subscription root field is allowed\")]\n    NoneOrMoreSubscriptionRootFields,","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/graphql/ir/src/error.rs#L43-L79","documentation":"The offset counterpart to the limit error: pagination offset arguments must fall within the accepted range. When the offset value provided in a query fails IR validation, this error reports the exact value. It guards data sources against invalid skip values (out-of-range or rejected by the argument parser).","triggerScenarios":"Passing an offset argument outside the accepted range for a connection/field — e.g. an offset exceeding the maximum allowed offset, or a value rejected during IR construction from request arguments.","commonSituations":"Deep-pagination requests with huge computed offsets (page * pageSize overflow); clients sending negative or oversized offsets after config tightening; cursor-vs-offset migration mistakes sending cursor values as offsets.","solutions":["Clamp or reduce the offset to within the allowed range before sending","Prefer cursor-based pagination for deep paging instead of large numeric offsets","If you operate the server, review/raise the configured max offset and document it in the schema"],"exampleFix":"# before\nquery {{ items(offset: 5000000, limit: 100) {{ id }} }}\n\n# after\nquery {{ items(first: 100, after: \"<cursor>\") {{ edges {{ cursor node {{ id }} }} }} }}","handlingStrategy":"validation","validationCode":"const MAX_OFFSET = 10000;\nconst offset = Math.max(0, Math.min(requestedOffset, MAX_OFFSET));","typeGuard":"function isValidOffset(v: number, max = 10000): v is number {{\n  return Number.isInteger(v) && v >= 0 && v <= max;\n}}","tryCatchPattern":"try {{\n  await fetchItems({{ offset }});\n}} catch (e: any) {{\n  if (/not a valid offset value/.test(e.message)) {{\n    return fetchItems({{ offset: 0 }}); // restart from beginning\n  }}\n  throw e;\n}}","preventionTips":["Bound computed offsets (page * size) before sending","Prefer cursor-based pagination for deep paging","Validate offset is a non-negative integer within configured bounds"],"tags":["graphql","pagination","offset","validation","rust"],"backgroundTag":"pagination-offset-invalid","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}