yikart/AiToEarn · error · AppException
ChannelPaginationPageSizeExceeded
ChannelPaginationPageSizeExceeded
Error message
ChannelPaginationPageSizeExceeded
What it means
In Page pagination mode, normalizeChannelPagination resolves pageSize to the platform's defaultPageSize when omitted, then enforces pageMetadata.maxPageSize. If the requested (or client-supplied) pageSize exceeds the platform's configured maximum, it throws ChannelPaginationPageSizeExceeded with the platform, requested pageSize, and allowed maxPageSize in the exception details.
Source
Thrown at project/aitoearn-backend/apps/aitoearn-server/src/core/channels/platforms/platform-pagination.helper.ts:46
platform,
limit,
maxLimit: cursorMetadata.maxLimit,
})
}
const direction = normalized.direction ?? ChannelPaginationDirection.Next
if (direction === ChannelPaginationDirection.Previous && !cursorMetadata.supportsPrevious) {
throw new AppException(ResponseCode.ChannelPaginationDirectionNotSupported, {
platform,
direction,
})
}
return { ...normalized, limit, direction }
}
case ChannelPaginationMode.Page: {
const pageMetadata = metadata as Extract<ChannelPaginationMetadata, { mode: ChannelPaginationMode.Page }>
const pageSize = normalized.pageSize ?? pageMetadata.defaultPageSize
if (pageSize > pageMetadata.maxPageSize) {
throw new AppException(ResponseCode.ChannelPaginationPageSizeExceeded, {
platform,
pageSize,
maxPageSize: pageMetadata.maxPageSize,
})
}
return { page: normalized.page ?? 1, pageSize }
}
}
return normalized
}
function getDefaultPagination(
metadata: ChannelPaginationMetadata,
pagination: ChannelPaginationInput,
): ChannelPaginationInput {
if (getPaginationInputMode(pagination) !== ChannelPaginationMode.None || metadata.mode === ChannelPaginationMode.None) {
return paginationView on GitHub (pinned to d3aa8bea5b)
Solutions
- Clamp pageSize to the platform's maxPageSize before the call: pageSize = Math.min(requestedPageSize, metadata.maxPageSize).
- Omit pageSize entirely so the platform's defaultPageSize is used.
- Read the platform's published pagination metadata (optionally via the metadata/capabilities endpoint) and offer only allowed page sizes in the UI.
- If the cap is wrong, update the platform integration's Page metadata maxPageSize.
Example fix
// before
await listWorks(accountId, { page: 1, pageSize: 200 })
// after
const meta = getPlatformPaginationMetadata(platform)
const pageSize = Math.min(200, meta.mode === ChannelPaginationMode.Page ? meta.maxPageSize : 200)
await listWorks(accountId, { page: 1, pageSize }) Defensive patterns
Strategy: validation
Validate before calling
const meta = platformPaginationMetadata[platform]
if (meta.mode === ChannelPaginationMode.Page && (requested.pageSize ?? 0) > meta.maxPageSize) {
requested = { ...requested, pageSize: meta.maxPageSize }
} Type guard
function isPageSizeAllowed(meta: ChannelPaginationMetadata, pageSize: number): boolean {
return meta.mode === ChannelPaginationMode.Page && pageSize <= meta.maxPageSize
} Try / catch
try {
return await listItems({ page, pageSize })
} catch (e) {
if (e instanceof AppException && e.code === ResponseCode.ChannelPaginationPageSizeExceeded) {
return await listItems({ page, pageSize: e.details.maxPageSize })
}
throw e
} Prevention
- Clamp pageSize to the platform max before every paginated call.
- Populate UI page-size dropdowns from the platform metadata, not hardcoded values.
- Prefer omitting pageSize to accept the platform default.
- Review page-size caps when adding or updating a platform integration.
When it happens
Trigger: Calling a paginated listing endpoint with pageSize > the platform's maxPageSize (e.g. passing pageSize: 100 to a platform whose ChannelPaginationMetadata is { mode: Page, maxPageSize: 50 }). Triggered whenever page or pageSize fields are present in the request and the mode is Page.
Common situations: Hardcoding a large page size for 'fewer requests' across all platforms; a UI page-size selector offering 100/200 that exceeds some platform caps; a default page size changed upstream without checking each platform's metadata; API clients copied from a platform with a higher cap.
Related errors
- ChannelPaginationLimitExceeded
- ChannelPaginationDirectionNotSupported
- No subtitle entries in response
- No response from Gemini
- Invalid subtitle data: ${z.prettifyError(result.error)}
AI-assisted analysis of yikart/AiToEarn@d3aa8bea5b (2026-08-31).
Data as JSON: /api/errors/042d39b310fa9305.
Report an issue: GitHub.