octobercms/october · error · ApplicationException

Invalid input data

Error message

Invalid input data

What it means

MediaManager::onGetSidebarThumbnail() takes 'path' and 'lastModified' from the request; lastModified is used as part of the thumbnail cache key and must be numeric. A missing, null, or non-numeric value (empty string, 'undefined', a formatted date) triggers the generic 'Invalid input data' ApplicationException. The stock sidebar JS always sends the item's lastModified attribute, so this points to a custom or degraded client.

Source

Thrown at modules/media/widgets/MediaManager.php:200

    /**
     * onGetSidebarThumbnail
     * @return array
     */
    public function onGetSidebarThumbnail()
    {
        $path = Input::get('path');
        $lastModified = Input::get('lastModified');

        $thumbnailParams = $this->getThumbnailParams();
        $thumbnailParams['width'] = 300;
        $thumbnailParams['height'] = 255;
        $thumbnailParams['mode'] = 'auto';

        $path = MediaLibrary::validatePath($path);

        if (!is_numeric($lastModified)) {
            throw new ApplicationException('Invalid input data');
        }

        // If the thumbnail file exists, just return the thumbnail markup,
        // otherwise generate a new thumbnail.
        $thumbnailPath = $this->thumbnailExists($thumbnailParams, $path, $lastModified);
        if ($thumbnailPath) {
            return [
                'markup' => $this->makePartial('thumbnail-image', [
                    'isError' => $this->thumbnailIsError($thumbnailPath),
                    'imageUrl' => $this->getThumbnailImageUrl($thumbnailPath)
                ])
            ];
        }

        $thumbnailInfo = $thumbnailParams;
        $thumbnailInfo['path'] = $path;
        $thumbnailInfo['lastModified'] = $lastModified;
        $thumbnailInfo['id'] = 'sidebar-thumbnail';

View on GitHub (pinned to b608633a7e)

Solutions

  1. Send an integer timestamp in the lastModified field — the item-list markup exposes it as a data attribute (item.lastModified); use it verbatim
  2. If lastModified is genuinely unknown, send time() as a cache-busting fallback
  3. Clear cached/combined backend assets and hard refresh so the current widget JavaScript posts the full payload

Example fix

// before — custom sidebar request omits lastModified
$.request('onGetSidebarThumbnail', { data: { path: item.path } });

// after — include the numeric mtime
$.request('onGetSidebarThumbnail', {
    data: { path: item.path, lastModified: item.lastModified }
});
Defensive patterns

Strategy: validation

Validate before calling

const lastModified = Number(item.lastModified);
if (!Number.isFinite(lastModified)) { /* skip or default */ lastModified = Math.floor(Date.now() / 1000); }
$.request('onGetSidebarThumbnail', { data: { path: item.path, lastModified } });

Prevention

When it happens

Trigger: Custom JS invoking the sidebar thumbnail AJAX handler without lastModified; file/item objects lacking lastModified so the JS sends the string 'undefined'; sending '2024-01-01 12:00' instead of a Unix timestamp; degraded/stale backend assets after a partial upgrade.

Common situations: Custom media pickers (e.g. a MediaFinder sidebar variant) built against the widget's endpoints; cached combined JS assets from an older version; API-driven tools posting form data by hand.

Related errors


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