{"record":{"id":"3f1643a61572978e","repo":"symfony/symfony","slug":"symbolic-link-s-was-created-but-appears-to-be-b","errorCode":null,"errorMessage":"Symbolic link \"%s\" was created but appears to be broken.","messagePattern":"Symbolic link \"(.+?)\" was created but appears to be broken\\.","errorType":"console","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php","lineNumber":231,"sourceCode":"        }\n\n        return $method;\n    }\n\n    /**\n     * Creates symbolic link.\n     *\n     * @throws IOException if link cannot be created\n     */\n    private function symlink(string $originDir, string $targetDir, bool $relative = false): void\n    {\n        if ($relative) {\n            $this->filesystem->mkdir(\\dirname($targetDir));\n            $originDir = $this->filesystem->makePathRelative($originDir, realpath(\\dirname($targetDir)));\n        }\n        $this->filesystem->symlink($originDir, $targetDir);\n        if (!file_exists($targetDir)) {\n            throw new IOException(\\sprintf('Symbolic link \"%s\" was created but appears to be broken.', $targetDir), 0, null, $targetDir);\n        }\n    }\n\n    /**\n     * Copies origin to target.\n     */\n    private function hardCopy(string $originDir, string $targetDir): string\n    {\n        $this->filesystem->mkdir($targetDir, 0o777);\n        // We use a custom iterator to ignore VCS files\n        $this->filesystem->mirror($originDir, $targetDir, Finder::create()->ignoreDotFiles(false)->in($originDir));\n\n        return self::METHOD_COPY;\n    }\n\n    private function getPublicDirectory(ContainerInterface $container): string\n    {\n        $defaultPublicDir = 'public';","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/symfony/symfony/blob/698e28026c22cf35d032cdb6e800db48b1535790/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php#L213-L249","documentation":"Thrown by assets:install's symlink() helper after it successfully calls $filesystem->symlink($originDir, $targetDir) but file_exists($targetDir) still returns false. This indicates the symlink was created but resolves to a non-existent or inaccessible target — a 'broken symlink' — so the command refuses to report success.","triggerScenarios":"Running `assets:install --symlink` when the bundle's Resources/public (or public) origin directory was removed after the symlink target computation, the origin path is on a filesystem that doesn't report through file_exists (some Windows/NFS setups), or the symlink target became stale mid-operation.","commonSituations":"Bundles whose assets directory doesn't exist at the computed origin path. NFS/Vagrant/Docker volume mounts where symlink resolution is unreliable. Windows without symlink privileges (though that usually fails at symlink() not here). Origin dir deleted/renamed after glob.","solutions":["Verify the bundle's origin assets directory exists at <BundlePath>/Resources/public or <BundlePath>/public.","On Windows, run the terminal as Administrator or enable Developer Mode for symlink support, or use copy mode (omit --symlink).","On NFS/volume mounts, prefer copy mode: `assets:install public` (no --symlink).","Re-run after fixing the origin dir; remove the broken symlink manually if needed."],"exampleFix":"# before\nphp bin/console assets:install public --symlink\n# -> 'Symbolic link ... appears to be broken'\n\n# after (fall back to copy)\nphp bin/console assets:install public\n# or fix the missing origin: ensure <Bundle>/Resources/public exists","handlingStrategy":"validation","validationCode":"// Verify the bundle origin exists before symlinking\nforeach ($kernel->getBundles() as $bundle) {\n    $origin = is_dir($bundle->getPath().'/Resources/public')\n        ? $bundle->getPath().'/Resources/public'\n        : $bundle->getPath().'/public';\n    if (!is_dir($origin)) { /* skip or warn */ }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["On Windows, enable Developer Mode or run as admin for symlink support, or use copy mode.","On NFS/volume mounts, omit --symlink and use copy.","Ensure each bundle's public/ assets dir exists before installing."],"tags":["console","assets","symlink","filesystem","windows","nfs"],"analyzedSha":"698e28026c22cf35d032cdb6e800db48b1535790","analyzedAt":"2026-08-06T23:40:49.025Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}