Budibase/budibase · warning · HTTPError

Limit query must be between 1 and 100

Error message

Limit query must be between 1 and 100

What it means

A syntactically valid numeric limit is still rejected with HTTPError 400 if it falls outside the allowed range of 1 to 100. This bounds result page size to protect the server and clients.

Source

Thrown at packages/server/src/api/controllers/ai/agentLogs.ts:53

    throw new HTTPError("Invalid bookmark query", 400)
  }

  return String(parsedBookmark)
}

function sanitizeLimitQuery(limit?: string): number | undefined {
  const normalizedLimit = limit?.trim()
  if (!normalizedLimit) {
    return undefined
  }

  if (!/^\d+$/.test(normalizedLimit)) {
    throw new HTTPError("Invalid limit query", 400)
  }

  const parsedLimit = Number.parseInt(normalizedLimit, 10)
  if (parsedLimit < 1 || parsedLimit > 100) {
    throw new HTTPError("Limit query must be between 1 and 100", 400)
  }

  return parsedLimit
}

function sanitizeDateQuery(
  value: string | undefined,
  queryName: "startDate" | "endDate"
): string | undefined {
  const normalizedValue = value?.trim()
  if (!normalizedValue) {
    return undefined
  }

  if (DATE_ONLY_REGEX.test(normalizedValue)) {
    return normalizedValue
  }

View on GitHub (pinned to a81a902e9a)

Solutions

  1. Clamp the limit to 1–100 on the client before sending
  2. Send no limit to accept the server default
  3. Update integrations that assumed larger page sizes

Example fix

// before
const limit = Math.max(0, desired) // may send 0 or >100
// after
const limit = Math.min(100, Math.max(1, desired))
Defensive patterns

Strategy: validation

Validate before calling

const n = parseInt(rawLimit, 10); const safeLimit = Math.min(100, Math.max(1, n))

Type guard

const isValidLimitRange = (n: number): boolean => Number.isInteger(n) && n >= 1 && n <= 100

Try / catch

try { await api.fetchAgentLogs({ limit }) } catch (e) { if (e.status === 400 && e.message.includes("between 1 and 100")) { /* clamp and retry once */ } else throw e }

Prevention

When it happens

Trigger: GET agent logs with ?limit=0, ?limit=101, ?limit=1000.

Common situations: Client clamping to its own max (e.g. 500) instead of the API's 100; sending 0 to mean "default".

Related errors


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