doctrine/orm · error · InvalidArgumentException
Proxies destination directory
Error message
Proxies destination directory '<info>%s</info>' does not exist.
What it means
After resolving dest-path (argument or configured proxy dir), orm:generate-proxies creates the directory if missing and resolves it with realpath(). If the path still cannot be resolved — mkdir() failed silently on an unwritable parent, a regular file occupies the path, or open_basedir blocks access — the file_exists() check fails and the command throws InvalidArgumentException('Proxies destination directory ... does not exist'). Note the message prints the configured proxy dir, not necessarily the path you passed.
Solutions
- Create the tree first: mkdir -p var/cache/prod/doctrine/orm/Proxies, then re-run the command.
- Check the configured proxy_dir for typos and ensure every parent exists and is writable by the CLI user.
- If open_basedir is enabled, add the proxy directory to the allowed paths.
Example fix
# before $ php bin/console orm:generate-proxies # InvalidArgumentException: Proxies destination directory '...' does not exist. # after $ mkdir -p var/cache/prod/doctrine/orm/Proxies $ php bin/console orm:generate-proxies var/cache/prod/doctrine/orm/Proxies
Defensive patterns
Strategy: validation
Validate before calling
$dir = $em->getConfiguration()->getProxyDir();
if ($dir !== null && ! is_dir($dir)) {
if (! @mkdir($dir, 0775, true) && ! is_dir($dir)) {
throw new RuntimeException("Cannot create proxy directory $dir");
}
}
// run orm:generate-proxies Prevention
- Pre-create proxy directories in the build/deploy step before running generate-proxies.
- Use absolute paths for proxy_dir so CLI working directory does not matter.
- Check open_basedir settings when CLI and web PHP configurations differ.
When it happens
Trigger: dest-path under a parent directory that does not exist or is not writable (mkdir() returns false, which the command does not check); a regular file sitting at the proxy-dir path; open_basedir restrictions in hardened CLI setups; typos in the configured proxy_dir.
Common situations: Fresh deploys where var/ subdirectories were never created; Docker volumes mounted after the image expected the path; relative proxy_dir resolved against a different CLI working directory.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Proxies destination directory
- Proxy directory cannot be null
- Invalid argument "--entity-class"
- Missing arguments "--owner-class" "--association"
- No Metadata cache driver is configured on given…
AI-assisted analysis of doctrine/orm@d9b9ff7301 (2026-08-21).
Data as JSON: /api/errors/acb2cf7c1998a710.
Report an issue: GitHub.
Appendix: source
Thrown at src/Tools/Console/Command/GenerateProxiesCommand.php:77
// Process destination directory
$destPath = $input->getArgument('dest-path');
if ($destPath === null) {
$destPath = $em->getConfiguration()->getProxyDir();
if ($destPath === null) {
throw new InvalidArgumentException('Proxy directory cannot be null');
}
}
if (! is_dir($destPath)) {
mkdir($destPath, 0775, true);
}
$destPath = realpath($destPath);
if (! file_exists($destPath)) {
throw new InvalidArgumentException(
sprintf("Proxies destination directory '<info>%s</info>' does not exist.", $em->getConfiguration()->getProxyDir()),
);
}
if (! is_writable($destPath)) {
throw new InvalidArgumentException(
sprintf("Proxies destination directory '<info>%s</info>' does not have write permissions.", $destPath),
);
}
if (empty($metadatas)) {
$ui->success('No Metadata Classes to process.');
return 0;
}
foreach ($metadatas as $metadata) {
$ui->text(sprintf('Processing entity "<info>%s</info>"', $metadata->name));View on GitHub (pinned to d9b9ff7301)