octobercms/october · error · ApplicationException

backend::lang.media.please_select_move_dest

Error message

backend::lang.media.please_select_move_dest

What it means

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.

Source

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

        $this->vars['folders'] = $folderList;
        $this->vars['originalPath'] = Input::get('path');

        return $this->makePartial('move-form');
    }

    /**
     * onMoveItems AJAX handler
     * @return array
     */
    public function onMoveItems()
    {
        if (!$this->checkHasPermission('mediaDelete')) {
            throw new ForbiddenException;
        }

        $dest = trim(Input::get('dest'));
        if (!strlen($dest)) {
            throw new ApplicationException(Lang::get('backend::lang.media.please_select_move_dest'));
        }

        $dest = MediaLibrary::validatePath($dest);
        if ($dest === Input::get('originalPath')) {
            throw new ApplicationException(Lang::get('backend::lang.media.move_dest_src_match'));
        }

        $files = Input::get('files', []);
        if (!is_array($files)) {
            throw new ApplicationException('Invalid input data');
        }

        $folders = Input::get('folders', []);
        if (!is_array($folders)) {
            throw new ApplicationException('Invalid input data');
        }

        $library = MediaLibrary::instance();

View on GitHub (pinned to b608633a7e)

Solutions

  1. Populate and require the destination field in the move popup before enabling submit
  2. Always include a concrete dest like dest='/subfolder' in the POST data
  3. If moving to the library root, send dest='/' explicitly — it passes the strlen check

Example fix

// before
$.request('onMoveItems', { data: { files, folders } });

// after
if (dest && dest.trim().length) {
    $.request('onMoveItems', { data: { dest, files, folders } });
}
Defensive patterns

Strategy: validation

Validate before calling

const dest = (selectedDest || '').trim();
if (!dest.length) { showToast('Select a destination folder'); return; }
$.request('onMoveItems', { data: { dest, files, folders, originalPath } });

Type guard

function hasMoveDestination(dest) {
  return typeof dest === 'string' && dest.trim().length > 0;
}

Try / catch

$.request('onMoveItems', { data }).fail(function (xhr) { showFlash(xhr.responseJSON?.X_OCTOBER_ERROR_MESSAGE?.[0] ?? 'Move failed'); });

Prevention

When it happens

Trigger: AJAX 'onMoveItems' with dest missing, dest='' or dest=' ' (trim yields strlen 0); the move popup submitted without a selected folder in the destination dropdown.

Common situations: 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.

Related errors


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