octobercms/october · error · SystemException

Unknown widget report interval {$widgetInterval}

Error message

Unknown widget report interval {$widgetInterval}

What it means

ReportFetchData::getRequestedDateInterval() maps the widget configuration key 'date_interval' onto the Dash::INTERVAL_TYPE_* constants ('dashboard', 'year', 'quarter', 'month', 'week', 'days', 'hour' — 'days' additionally reads 'date_interval_days'). When the config value matches none of them, the switch default throws, embedding the offending value.

Source

Thrown at modules/dashboard/classes/ReportFetchData.php:233

                break;
            case Dash::INTERVAL_TYPE_MONTH:
                $dateStart = Carbon::now()->startOfMonth();
                break;
            case Dash::INTERVAL_TYPE_WEEK:
                $dateStart = Carbon::now()->startOfWeek(Carbon::MONDAY); // TODO
                break;
            case Dash::INTERVAL_TYPE_HOUR:
                $dateEnd = null;
                $startTimestamp = time() - 3600;
                break;
            case Dash::INTERVAL_TYPE_DAYS:
                $days = isset($this->widgetConfig['date_interval_days'])
                    ? $this->widgetConfig['date_interval_days']
                    : 1;
                $dateStart = Carbon::now()->subDays($days - 1);
                break;
            default:
                throw new SystemException("Unknown widget report interval {$widgetInterval}");
        }

        return [
            $dateStart,
            $dateEnd,
            $startTimestamp
        ];
    }

    /**
     * parseDashboardDate safely parses a dashboard date from the browser.
     */
    protected function parseDashboardDate(?string $value): ?Carbon
    {
        $value = trim((string) $value);
        if ($value === '') {
            return null;
        }

View on GitHub (pinned to b608633a7e)

Solutions

  1. Open the widget's settings in the dashboard UI and re-select a supported interval, then save — this rewrites the config
  2. Directly fix the stored config: UPDATE the widget data so date_interval is one of Dash::INTERVAL_TYPE_* ('dashboard', 'year', 'quarter', 'month', 'week', 'days', 'hour')
  3. Delete the stale widget record and re-create the widget if its config cannot be repaired
  4. After upgrading the dashboard module, audit existing widget configs for removed interval values

Example fix

// before (persisted widget config)
{"date_interval": "day", "date_interval_days": 30}

// after
{"date_interval": "days", "date_interval_days": 30}
Defensive patterns

Strategy: try-catch

Validate before calling

$knownIntervals = [
    Dash::INTERVAL_TYPE_DASHBOARD,
    Dash::INTERVAL_TYPE_YEAR,
    Dash::INTERVAL_TYPE_QUARTER,
    Dash::INTERVAL_TYPE_MONTH,
    Dash::INTERVAL_TYPE_WEEK,
    Dash::INTERVAL_TYPE_DAYS,
    Dash::INTERVAL_TYPE_HOUR,
];
$interval = $widgetConfig['date_interval'] ?? Dash::INTERVAL_TYPE_DASHBOARD;
if (!in_array($interval, $knownIntervals, true)) {
    // repair stale config before it reaches ReportFetchData
    $widgetConfig['date_interval'] = Dash::INTERVAL_TYPE_DASHBOARD;
}

Type guard

function isKnownWidgetInterval(string $interval): bool
{
    return in_array($interval, [
        Dash::INTERVAL_TYPE_DASHBOARD,
        Dash::INTERVAL_TYPE_YEAR,
        Dash::INTERVAL_TYPE_QUARTER,
        Dash::INTERVAL_TYPE_MONTH,
        Dash::INTERVAL_TYPE_WEEK,
        Dash::INTERVAL_TYPE_DAYS,
        Dash::INTERVAL_TYPE_HOUR,
    ], true);
}

Try / catch

try {
    $fetchData = new ReportFetchData($dataSource, $widgetConfig, $extraData);
} catch (SystemException $e) {
    // stale widget config — reset the interval and retry once with a safe default
    $widgetConfig['date_interval'] = Dash::INTERVAL_TYPE_DASHBOARD;
    $fetchData = new ReportFetchData($dataSource, $widgetConfig, $extraData);
}

Prevention

When it happens

Trigger: A widget whose persisted config contains date_interval = 'day' (singular typo), 'last-30-days', or a value written by an older module version — anything not in Dash::INTERVAL_TYPE_*. Note: when the key is absent the code defaults to INTERVAL_TYPE_DASHBOARD and does not throw.

Common situations: Widget records in system_widget_data created by an older version of the dashboard module, hand-edited widget config JSON, or DB restores across plugin versions that changed the interval vocabulary.

Related errors


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