octobercms/october · error · ApplicationException

Start and end dates cannot be set if the start timestamp is…

Error message

Start and end dates cannot be set if the start timestamp is also set.

What it means

Constructor guard in ReportDataQueryBuilder: mutually exclusive time-range inputs were supplied together — both a start/end date pair and a raw startTimestamp. The query builder accepts exactly one way of specifying the period.

Solutions

  1. Use either startDate/endDate or startTimestamp, not both
  2. Strip the unused date arguments when building from widget data
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/dashboard/classes/ReportDataQueryBuilder.php:168 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/2c481e42133578ba. Report an issue: GitHub.

Appendix: source

Thrown at modules/dashboard/classes/ReportDataQueryBuilder.php:168

    public function __construct(
        string $tableName,
        ReportDimension $dimension,
        array $metrics,
        ReportDataOrderRule $orderRule,
        ?array $dimensionFilters,
        ?int $limit,
        ?ReportDataPaginationParams $paginationParams,
        ?string $groupInterval,
        bool $hideEmptyDimensionValues,
        ?Carbon $startDate,
        ?Carbon $endDate,
        ?int $startTimestamp,
        ?string $dateColumnName,
        ?string $timestampColumnName,
        bool $totalsOnly
    ) {
        if (($startDate || $endDate) && $startTimestamp !== null) {
            throw new ApplicationException('Start and end dates cannot be set if the start timestamp is also set.');
        }

        if (!$startDate && $startTimestamp === null) {
            throw new ApplicationException('Either the start and end dates or the start timestamp must be set.');
        }

        $this->tableName = $tableName;
        $this->metrics = $metrics;
        $this->dimension = $dimension;
        $this->limit = $limit;
        $this->orderRule = $orderRule;
        $this->dimensionFilters = $dimensionFilters;
        $this->groupInterval = $groupInterval;
        $this->hideEmptyDimensionValues = $hideEmptyDimensionValues;
        $this->paginationParams = $paginationParams;
        $this->startDate = $startDate;
        $this->endDate = $endDate;
        $this->dateColumnName = $dateColumnName;

View on GitHub (pinned to b608633a7e)