Budibase/budibase · error · Error

Cannot paginate query without a limit

Error message

Cannot paginate query without a limit

What it means

When pagination is requested (`paginate: true`) for an external table search, a `limit` must also be provided, because the pagination math needs a page size. Searching by row ID short-circuits before this check.

Source

Thrown at packages/server/src/sdk/workspace/rows/search/external.ts:42

import { outputProcessing } from "../../../../utilities/rowProcessor"
import { ExportRowsParams, ExportRowsResult } from "./types"
import { isSearchingByRowID } from "./utils"

function getPaginationAndLimitParameters(
  filters: SearchFilters,
  paginate: boolean | undefined,
  bookmark: number | undefined,
  limit: number | undefined
): PaginationJson | undefined {
  let paginateObj: PaginationJson | undefined

  // only try set limits/pagination if we aren't doing a row ID search
  if (isSearchingByRowID(filters)) {
    return
  }

  if (paginate && !limit) {
    throw new Error("Cannot paginate query without a limit")
  }

  if (paginate && limit) {
    paginateObj = {
      // add one so we can track if there is another page
      limit: limit + 1,
    }
    if (bookmark) {
      paginateObj.offset = bookmark
    }
  } else if (limit) {
    paginateObj = {
      limit: limit,
    }
  }

  return paginateObj
}

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Provide a limit whenever paginate is true
  2. Or disable pagination (paginate: false) for unbounded searches
  3. Default the limit in the calling layer (e.g. limit ?? 50)

Example fix

// before
await sdk.rows.search({ tableId, query, paginate: true })
// after
await sdk.rows.search({ tableId, query, paginate: true, limit: 25 })
Defensive patterns

Strategy: validation

Validate before calling

if (opts.paginate && !opts.limit) opts.limit = 25

Try / catch

try { await sdk.rows.search(opts) } catch (e) { if (e.message.includes('Cannot paginate query without a limit')) { /* set limit and retry */ } else throw e }

Prevention

When it happens

Trigger: Calling external search with paginate=true but no limit, e.g. through sdk.rows.search on an external table with pagination enabled.

Common situations: Client enables 'next page' UI without setting a page size; default limit lost between layers; passing paginate flag from one config and limit from another where limit is undefined.

Related errors


AI-assisted analysis of Budibase/budibase@a81a902e9a (2026-08-29). Data as JSON: /api/errors/e9d076f8926e4941. Report an issue: GitHub.