octobercms/october · error · ApplicationException
Unable to create directory {metaPath}
Error message
Unable to create directory {metaPath} What it means
The second makeDirectory() in ThemeExport::export() creates the {tempPath}/meta staging subdirectory for the theme's meta folder. The parent directory was just created successfully, so a failure here means the ability to write was lost mid-flow (quota hit between the two calls, permissions changed, security software interference) or a file named meta already blocks the path.
Source
Thrown at modules/cms/models/ThemeExport.php:114
* export
*/
public function export($theme, $data = [])
{
$this->theme = $theme;
$this->fill($data);
try {
$themePath = $this->theme->getPath();
$tempPath = temp_path() . '/'.uniqid('oc');
$zipName = uniqid('oc');
$zipPath = temp_path().'/'.$zipName;
if (!File::makeDirectory($tempPath)) {
throw new ApplicationException('Unable to create directory '.$tempPath);
}
if (!File::makeDirectory($metaPath = $tempPath . '/meta')) {
throw new ApplicationException('Unable to create directory '.$metaPath);
}
File::copy($themePath.'/theme.yaml', $tempPath.'/theme.yaml');
File::copyDirectory($themePath.'/meta', $metaPath);
foreach ($this->folders as $folder) {
if (!array_key_exists($folder, $this->getFoldersOptions())) {
continue;
}
File::copyDirectory($themePath.'/'.$folder, $tempPath.'/'.$folder);
}
Zip::make($zipPath, $tempPath);
File::deleteDirectory($tempPath);
}
catch (Exception $ex) {
if (strlen($tempPath) && File::isDirectory($tempPath)) {View on GitHub (pinned to b608633a7e)
Solutions
- Free space in storage/temp (delete stale oc* directories) and retry the export.
- Re-verify permissions and quota on the storage volume: the oc* parent was created, so look for quota/inode limits or a conflicting 'meta' entry inside it.
- Remove partially created temp_path()/oc* directories before retrying so the run starts clean.
- If it recurs, inspect system logs for the underlying mkdir errno (permissions vs ENOSPC).
Example fix
# before: mid-export failure - 'Unable to create directory {tempPath}/meta'
find storage/temp -maxdepth 1 -name 'oc*' -exec rm -rf {} +
df -h storage # ensure free space
# after: retry export - fresh oc* staging tree builds cleanly Defensive patterns
Strategy: validation
Validate before calling
$temp = temp_path();
if (!is_writable($temp) || disk_free_space($temp) < 100 * 1024 * 1024) {
// abort export before it starts staging meta/
} Try / catch
try {
$token = ThemeExport::export($theme, $data);
} catch (ApplicationException $e) {
// mid-export failure: sweep stale oc* dirs in temp_path() and free space/quota before retry
} Prevention
- Keep storage/temp clear of stale oc* directories from interrupted runs.
- Watch quota/inode limits on the storage volume, not just byte usage.
- Alert on any export failure so a mid-flow permission/quota change is caught early.
When it happens
Trigger: Running a theme export where the first mkdir under storage/temp succeeds but the meta subdir creation returns false - mid-export quota exhaustion, concurrent hardening of permissions, or a leftover file named meta inside the freshly generated oc* temp path.
Common situations: Disk quota that fills while copying a large theme; concurrent exports racing for space; container storage quotas; rarely, a corrupted temp path from a previous interrupted run.
Related errors
- Unable to create directory {tempPath}
- Unable to create directory {tempPath}
- backend::lang.media.error_creating_folder
- cms::lang.cms_object.error_creating_directory
- cms::lang.cms_object.error_saving
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/0a3f6ee7d7a8d9e6.
Report an issue: GitHub.