octobercms/october · error · SystemException
Current page is not set for a paginated query
Error message
Current page is not set for a paginated query
What it means
When a widget's configuration has a non-empty 'records_per_page', ReportFetchData builds pagination parameters and requires the request to supply the current page. getRequestedPaginationParams() throws when the 'current_page' key is absent from the fetch request's extraData.
Source
Thrown at modules/dashboard/classes/ReportFetchData.php:327
return new ReportDataOrderRule(ReportDataOrderRule::ATTR_TYPE_DIMENSION);
}
$sortBy = $this->widgetConfig['sortBy'];
$sortOrder = $this->widgetConfig['sortOrder'];
return ReportDataOrderRule::createFromWidgetConfig($sortOrder, $sortBy);
}
/**
* getRequestedPaginationParams
*/
protected function getRequestedPaginationParams(): ?ReportDataPaginationParams
{
if (empty($this->widgetConfig['records_per_page'])) {
return null;
}
if (!array_key_exists('current_page', $this->extraData)) {
throw new SystemException('Current page is not set for a paginated query');
}
return new ReportDataPaginationParams(
(int) $this->widgetConfig['records_per_page'],
(int) $this->extraData['current_page']
);
}
/**
* getRequestedMetricsConfiguration
*/
protected function getRequestedMetricsConfiguration(): array
{
if (!$this->metricCodes) {
return [];
}
$result = [];View on GitHub (pinned to b608633a7e)
Solutions
- Always include current_page (1-based integer) in the fetch request when the widget has records_per_page set
- Clear the records_per_page value in the widget configuration to disable pagination if the front-end cannot send the page
- When proxying requests, default the value server-side: $extraData['current_page'] = $extraData['current_page'] ?? 1 before invoking the handler
Example fix
// before
$handler->onFetchData([
'metrics' => ['total'],
]);
// after
$handler->onFetchData([
'metrics' => ['total'],
'current_page' => 1,
]); Defensive patterns
Strategy: validation
Validate before calling
// client side: always send the page for paginated widgets $extraData['current_page'] = max(1, (int) ($extraData['current_page'] ?? 1)); // server side: default the page before invoking the fetch handler $this->extraData['current_page'] = $this->extraData['current_page'] ?? 1;
Type guard
function hasRequiredPaginationParams(array $widgetConfig, array $extraData): bool
{
if (empty($widgetConfig['records_per_page'])) {
return true; // pagination disabled, no page required
}
return array_key_exists('current_page', $extraData);
} Try / catch
try {
$result = $widget->onFetchData($extraData);
} catch (SystemException $e) {
if (str_contains($e->getMessage(), 'Current page is not set')) {
$extraData['current_page'] = 1;
return $widget->onFetchData($extraData);
}
throw $e;
} Prevention
- Whenever records_per_page is configured, make the front-end always submit current_page (1-based)
- At API proxies, default current_page to 1 before calling the handler
- Disabling pagination (clear records_per_page) also removes the requirement
When it happens
Trigger: A fetch request against a widget configured with records_per_page = 20 whose AJAX payload lacks current_page — e.g. a custom client that only sends filters/metrics, or a first load path that calls the handler without page information.
Common situations: Enabling pagination in widget config without updating the front-end to always send the page; integrating the dashboard data API from external scripts that mimic the payload incompletely; upgrades that added pagination to existing widgets.
Related errors
- Invalid compare specifier
- Unknown dimension type:
- Date dimensions cannot have fields.
- The dimension metric is already registered:
- Unknown dimension specified:
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/b5b4ced59ad1047c.
Report an issue: GitHub.