{"record":{"id":"9e12060425c1067f","repo":"octobercms/october","slug":"backend-lang-media-please-select-move-dest","errorCode":null,"errorMessage":"backend::lang.media.please_select_move_dest","messagePattern":"backend::lang\\.media\\.please_select_move_dest","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/media/widgets/MediaManager.php","lineNumber":597,"sourceCode":"        $this->vars['folders'] = $folderList;\n        $this->vars['originalPath'] = Input::get('path');\n\n        return $this->makePartial('move-form');\n    }\n\n    /**\n     * onMoveItems AJAX handler\n     * @return array\n     */\n    public function onMoveItems()\n    {\n        if (!$this->checkHasPermission('mediaDelete')) {\n            throw new ForbiddenException;\n        }\n\n        $dest = trim(Input::get('dest'));\n        if (!strlen($dest)) {\n            throw new ApplicationException(Lang::get('backend::lang.media.please_select_move_dest'));\n        }\n\n        $dest = MediaLibrary::validatePath($dest);\n        if ($dest === Input::get('originalPath')) {\n            throw new ApplicationException(Lang::get('backend::lang.media.move_dest_src_match'));\n        }\n\n        $files = Input::get('files', []);\n        if (!is_array($files)) {\n            throw new ApplicationException('Invalid input data');\n        }\n\n        $folders = Input::get('folders', []);\n        if (!is_array($folders)) {\n            throw new ApplicationException('Invalid input data');\n        }\n\n        $library = MediaLibrary::instance();","sourceCodeStart":579,"sourceCodeEnd":615,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/media/widgets/MediaManager.php#L579-L615","documentation":"Thrown by onMoveItems when the destination folder is empty after trimming. The widget requires an explicit destination ('dest') before moving any files or folders, so an absent or whitespace-only value is refused before path validation or the source/destination comparison runs.","triggerScenarios":"AJAX 'onMoveItems' with dest missing, dest='' or dest='   ' (trim yields strlen 0); the move popup submitted without a selected folder in the destination dropdown.","commonSituations":"The destination select in the move popup rendered empty (e.g. listAllDirectories failed earlier); user pressed Enter before choosing; custom script moving files forgot the dest field.","solutions":["Populate and require the destination field in the move popup before enabling submit","Always include a concrete dest like dest='/subfolder' in the POST data","If moving to the library root, send dest='/' explicitly — it passes the strlen check"],"exampleFix":"// before\n$.request('onMoveItems', { data: { files, folders } });\n\n// after\nif (dest && dest.trim().length) {\n    $.request('onMoveItems', { data: { dest, files, folders } });\n}","handlingStrategy":"validation","validationCode":"const dest = (selectedDest || '').trim();\nif (!dest.length) { showToast('Select a destination folder'); return; }\n$.request('onMoveItems', { data: { dest, files, folders, originalPath } });","typeGuard":"function hasMoveDestination(dest) {\n  return typeof dest === 'string' && dest.trim().length > 0;\n}","tryCatchPattern":"$.request('onMoveItems', { data }).fail(function (xhr) { showFlash(xhr.responseJSON?.X_OCTOBER_ERROR_MESSAGE?.[0] ?? 'Move failed'); });","preventionTips":["Require a destination selection before enabling the move button","Default the dropdown to '/' (root) so it is never empty","Scripted moves should assert dest is a non-empty string"],"tags":["media-manager","required-field","move","backend-ajax"],"backgroundTag":"required-field-missing","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}