{"record":{"id":"c3ef4b92999cd9a3","repo":"doctrine/orm","slug":"proxies-destination-directory-info-s-info-do-c3ef4b","errorCode":null,"errorMessage":"Proxies destination directory '<info>%s</info>' does not have write permissions.","messagePattern":"Proxies destination directory '<info>(.+?)</info>' does not have write permissions\\.","errorType":"console","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Tools/Console/Command/GenerateProxiesCommand.php","lineNumber":83,"sourceCode":"            if ($destPath === null) {\n                throw new InvalidArgumentException('Proxy directory cannot be null');\n            }\n        }\n\n        if (! is_dir($destPath)) {\n            mkdir($destPath, 0775, true);\n        }\n\n        $destPath = realpath($destPath);\n\n        if (! file_exists($destPath)) {\n            throw new InvalidArgumentException(\n                sprintf(\"Proxies destination directory '<info>%s</info>' does not exist.\", $em->getConfiguration()->getProxyDir()),\n            );\n        }\n\n        if (! is_writable($destPath)) {\n            throw new InvalidArgumentException(\n                sprintf(\"Proxies destination directory '<info>%s</info>' does not have write permissions.\", $destPath),\n            );\n        }\n\n        if (empty($metadatas)) {\n            $ui->success('No Metadata Classes to process.');\n\n            return 0;\n        }\n\n        foreach ($metadatas as $metadata) {\n            $ui->text(sprintf('Processing entity \"<info>%s</info>\"', $metadata->name));\n        }\n\n        // Generating Proxies\n        $em->getProxyFactory()->generateProxyClasses($metadatas, $destPath);\n\n        // Outputting information message","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/doctrine/orm/blob/d9b9ff73016bf598ae07515f97289ce8074e97a5/src/Tools/Console/Command/GenerateProxiesCommand.php#L65-L101","documentation":"The last filesystem gate in orm:generate-proxies: the resolved destination directory must be writable because the command writes the generated proxy class files into it. When is_writable($destPath) is false — wrong owner, read-only filesystem — it throws InvalidArgumentException('...does not have write permissions').","triggerScenarios":"The proxy directory is owned by a different user than the one running the command (root-created var/ during image build, deploy user runs CLI); read-only or immutable filesystems; directories created by php-fpm with restrictive modes; group write missing on shared setups.","commonSituations":"Deploy pipelines switching users between build and release steps; Docker volumes with wrong ownership; shared hosting where the web server user owns cache directories.","solutions":["Fix ownership and mode: chown -R <user>: var/cache/... and chmod -R u+w (or run the command as the directory owner).","Point proxy_dir at a path guaranteed writable by the CLI user (e.g. under var/cache or artifacts baked into the image).","On read-only-filesystem deployments, generate proxies at build time instead of deploy time."],"exampleFix":"# before\n$ php bin/console orm:generate-proxies\n# InvalidArgumentException: ... does not have write permissions.\n\n# after\n$ sudo chown -R $(whoami): var/cache/prod/doctrine/orm/Proxies\n$ chmod -R u+w var/cache/prod/doctrine/orm/Proxies\n$ php bin/console orm:generate-proxies","handlingStrategy":"validation","validationCode":"$dir = $em->getConfiguration()->getProxyDir();\nif ($dir !== null && ! is_writable($dir)) {\n    throw new RuntimeException('Proxy directory ' . $dir . ' is not writable by user ' . get_current_user());\n}\n// run orm:generate-proxies","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the command as the same user that owns the cache/proxy directories, or fix ownership first.","Generate proxies at build time on read-only filesystem deployments.","Include an is_writable() preflight check in deploy scripts."],"tags":["doctrine-orm","console","proxy","filesystem","permissions","cli"],"backgroundTag":"filesystem-permission-denied","analyzedSha":"d9b9ff73016bf598ae07515f97289ce8074e97a5","analyzedAt":"2026-08-21T06:13:15.863Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}