{"record":{"id":"c96ccd047f8c305c","repo":"FuelLabs/fuels-ts","slug":"invalid-input-parameters-c96ccd","errorCode":"INVALID_INPUT_PARAMETERS","errorMessage":"Pagination arguments \"after\" and \"before\" cannot be used together","messagePattern":"Pagination arguments \"after\" and \"before\" cannot be used together","errorType":"validation","errorClass":"FuelError","httpStatus":null,"severity":"warning","filePath":"packages/account/src/providers/utils/validate-pagination-args.ts","lineNumber":16,"sourceCode":"import { FuelError, ErrorCode } from '@fuel-ts/errors';\n\nimport type { CursorPaginationArgs } from '../provider';\n\n/**\n * @hidden\n */\nexport const validatePaginationArgs = (params: {\n  inputArgs?: CursorPaginationArgs;\n  paginationLimit: number;\n}): CursorPaginationArgs => {\n  const { paginationLimit, inputArgs = {} } = params;\n  const { first, last, after, before } = inputArgs;\n\n  if (after && before) {\n    throw new FuelError(\n      ErrorCode.INVALID_INPUT_PARAMETERS,\n      'Pagination arguments \"after\" and \"before\" cannot be used together'\n    );\n  }\n\n  if ((first || 0) > paginationLimit || (last || 0) > paginationLimit) {\n    throw new FuelError(\n      ErrorCode.INVALID_INPUT_PARAMETERS,\n      `Pagination limit for this query cannot exceed ${paginationLimit} items`\n    );\n  }\n\n  if (first && before) {\n    throw new FuelError(\n      ErrorCode.INVALID_INPUT_PARAMETERS,\n      'The use of pagination argument \"first\" with \"before\" is not supported'\n    );\n  }","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/account/src/providers/utils/validate-pagination-args.ts#L1-L34","documentation":"Thrown by `validatePaginationArgs()` when both `after` and `before` cursor arguments are supplied simultaneously. GraphQL cursor pagination semantics are exclusive: you page forward from `after` or backward from `before`, never both at once. The validator rejects this before the query is sent to the node.","triggerScenarios":"Calling any paginated provider query (e.g. `getTransactions`, `getBlocks`, `getCoins`) with `inputArgs: { after, before }` both set to cursor strings. The validator at validate-pagination-args.ts:15 trips.","commonSituations":"Generic pagination UI that always forwards both cursors from a previous response; merging page-state objects naively; building a 'jump to page' feature that sets both bounds.","solutions":["Pass only one of `after` (forward) or `before` (backward) per query.","Reset the opposing cursor to undefined when setting one.","Use the helper `validatePaginationArgs` directly to test your args before calling the provider."],"exampleFix":"// before\nprovider.getTransactions({ first: 10, after: cursorA, before: cursorB });\n// after\nprovider.getTransactions({ first: 10, after: cursorA });\n// for backward paging:\nprovider.getTransactions({ last: 10, before: cursorB });","handlingStrategy":"validation","validationCode":"function validateCursors(args: { after?: string; before?: string }) {\n  if (args.after && args.before) throw new Error('use after XOR before, not both');\n  return args.after ? { after: args.after } : args.before ? { before: args.before } : {};\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Pass only after (forward) or before (backward), not both.","Reset the opposing cursor when setting one in UI state.","Centralize cursor handling in one pagination module."],"tags":["pagination","graphql","validation","query"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}