octobercms/october · error · SystemException

system::lang.directory.create_fail

Error message

system::lang.directory.create_fail

What it means

Filesystem guard in makeDirectorySafe: the target cache directory either exists but is not writable, or could not be created after retries. The combiner/code-parser cache path named in the message is the input at fault.

Solutions

  1. Grant the web server write access to the cache directory
  2. Create the directory manually with correct ownership
  3. Check disk space and safe-mode/open_basedir restrictions
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at modules/cms/classes/CodeParser.php:377 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at modules/cms/classes/CodeParser.php:377

            if (function_exists('opcache_invalidate') && ini_get('opcache.enable')) {
                opcache_invalidate($path, true);
            }
            elseif (function_exists('apc_compile_file')) {
                apc_compile_file($path);
            }
        }
    }

    /**
     * makeDirectorySafe makes a directory with concurrency support
     */
    protected function makeDirectorySafe($dir)
    {
        $count = 0;

        if (is_dir($dir)) {
            if (!is_writable($dir)) {
                throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir]));
            }

            return;
        }

        while (!is_dir($dir) && !@mkdir($dir, 0755, true)) {
            usleep(rand(50000, 200000));

            if ($count++ > 10) {
                throw new SystemException(Lang::get('system::lang.directory.create_fail', ['name'=>$dir]));
            }
        }

        File::chmodRecursive($dir);
    }
}

View on GitHub (pinned to b608633a7e)