{"record":{"id":"ee4fd551215dab14","repo":"octobercms/october","slug":"invalid-input-data","errorCode":null,"errorMessage":"Invalid input data","messagePattern":"Invalid input data","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/media/widgets/MediaManager.php","lineNumber":200,"sourceCode":"\n    /**\n     * onGetSidebarThumbnail\n     * @return array\n     */\n    public function onGetSidebarThumbnail()\n    {\n        $path = Input::get('path');\n        $lastModified = Input::get('lastModified');\n\n        $thumbnailParams = $this->getThumbnailParams();\n        $thumbnailParams['width'] = 300;\n        $thumbnailParams['height'] = 255;\n        $thumbnailParams['mode'] = 'auto';\n\n        $path = MediaLibrary::validatePath($path);\n\n        if (!is_numeric($lastModified)) {\n            throw new ApplicationException('Invalid input data');\n        }\n\n        // If the thumbnail file exists, just return the thumbnail markup,\n        // otherwise generate a new thumbnail.\n        $thumbnailPath = $this->thumbnailExists($thumbnailParams, $path, $lastModified);\n        if ($thumbnailPath) {\n            return [\n                'markup' => $this->makePartial('thumbnail-image', [\n                    'isError' => $this->thumbnailIsError($thumbnailPath),\n                    'imageUrl' => $this->getThumbnailImageUrl($thumbnailPath)\n                ])\n            ];\n        }\n\n        $thumbnailInfo = $thumbnailParams;\n        $thumbnailInfo['path'] = $path;\n        $thumbnailInfo['lastModified'] = $lastModified;\n        $thumbnailInfo['id'] = 'sidebar-thumbnail';","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/media/widgets/MediaManager.php#L182-L218","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Send an integer timestamp in the lastModified field — the item-list markup exposes it as a data attribute (item.lastModified); use it verbatim","If lastModified is genuinely unknown, send time() as a cache-busting fallback","Clear cached/combined backend assets and hard refresh so the current widget JavaScript posts the full payload"],"exampleFix":"// before — custom sidebar request omits lastModified\n$.request('onGetSidebarThumbnail', { data: { path: item.path } });\n\n// after — include the numeric mtime\n$.request('onGetSidebarThumbnail', {\n    data: { path: item.path, lastModified: item.lastModified }\n});","handlingStrategy":"validation","validationCode":"const lastModified = Number(item.lastModified);\nif (!Number.isFinite(lastModified)) { /* skip or default */ lastModified = Math.floor(Date.now() / 1000); }\n$.request('onGetSidebarThumbnail', { data: { path: item.path, lastModified } });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair path with the item's lastModified attribute when hitting thumbnail endpoints","Coerce to Number and fall back to now() when mtime is unavailable","Keep backend widget assets current so the shipped JS matches the endpoint contract"],"tags":["media","ajax","request-payload","thumbnails","media-manager"],"backgroundTag":"missing-invalid-request-parameter","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}