octobercms/october · error · ApplicationException
editor::lang.filesystem.type_not_allowed
Error message
editor::lang.filesystem.type_not_allowed
What it means
Thrown by editorRenameFileOrDirectory when renaming a FILE (directories are exempt) whose new extension is not in $allowedFileExtensions (line 84). For theme assets the list is FileDefinitions::get('asset_extensions') with less/sass/scss removed when safe mode is on. The message interpolates the allowed list: 'Only the following file types are allowed: :allowed_types'.
Source
Thrown at modules/editor/traits/FileSystemFunctions.php:84
throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_path'));
}
if (!$this->validateFileSystemName($newName)) {
throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_name'));
}
$originalPath = trim($originalPath);
if (!$this->validateFileSystemPath($originalPath)) {
throw new ApplicationException(Lang::get('editor::lang.filesystem.invalid_path'));
}
$originalFullPath = $basePath.'/'.$originalPath;
if (!file_exists($originalFullPath)) {
throw new ApplicationException(Lang::get('editor::lang.filesystem.original_not_found'));
}
if (!is_dir($originalFullPath) && !$this->validateFileSystemFileExtension($newName, $allowedFileExtensions)) {
throw new ApplicationException(Lang::get(
'editor::lang.filesystem.type_not_allowed',
['allowed_types' => implode(', ', $allowedFileExtensions)]
));
}
// Block renaming to a .svg target
if (
!is_dir($originalFullPath) &&
Config::get('media.clean_vectors', true) &&
strtolower(File::extension($newName)) === 'svg' &&
strtolower(File::extension($originalPath)) !== 'svg'
) {
throw new ApplicationException(Lang::get(
'editor::lang.filesystem.type_not_allowed',
['allowed_types' => implode(', ', array_diff($allowedFileExtensions, ['svg']))]
));
}
View on GitHub (pinned to b608633a7e)
Solutions
- Keep the file's existing extension, or rename to one of the types listed in the error message
- If the type is genuinely needed, add it to 'asset_extensions' in config/cms.php (it merges with FileDefinitions::get)
- If safe mode stripped less/sass/scss, disable safe_mode (dev only) or rename to a non-preprocessor extension
- Create the new file with the wanted extension via upload (onAssetUpload validates the same list) instead of renaming
Example fix
// config/cms.php
// before
'asset_extensions' => FileDefinitions::get('asset_extensions'),
// after — allow xml assets
'asset_extensions' => array_merge(FileDefinitions::get('asset_extensions'), ['xml']), Defensive patterns
Strategy: validation
Validate before calling
$allowed = FileDefinitions::get('asset_extensions');
if (System::checkSafeMode()) {
$allowed = array_diff($allowed, ['less', 'sass', 'scss']);
}
$newExt = strtolower(pathinfo($newName, PATHINFO_EXTENSION));
if (!in_array($newExt, $allowed, true)) {
// pick a name with an allowed extension before sending the command
} Prevention
- Keep the original extension when renaming; change file type via upload, not rename
- Know your effective list: config/cms.php asset_extensions, minus less/sass/scss under safe mode
- Show the allowed list in custom UIs before the user submits a new name
When it happens
Trigger: command_onAssetRename where 'name' changes the extension to a type outside the asset list, e.g. 'notes.txt', 'data.xml', or dropping the extension entirely; or renaming 'theme.less' to anything while System::checkSafeMode() is true, because getSafeAssetExtensions() strips less/sass/scss in safe mode.
Common situations: Trying to 'convert' an asset by changing its extension in the rename dialog; safe_mode enabled in config/cms.php hiding preprocessor extensions; a customized 'asset_extensions' definition in config/cms.php or a plugin that no longer includes the type you want.
Related errors
- editor::lang.filesystem.error_deleting_dir_not_empty
- editor::lang.filesystem.selected_files_not_found
- editor::lang.filesystem.select_destination_dir
- editor::lang.filesystem.destination_exists
- editor::lang.filesystem.directory_name_cant_be_empty
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/12c326a11788d12f.
Report an issue: GitHub.