{"record":{"id":"f13bc64800cd3475","repo":"symfony/translation","slug":"s-defined-in-translator-paths-does-not-exist-or-is-not-a","errorCode":null,"errorMessage":"\"%s\" defined in translator.paths does not exist or is not a directory.","messagePattern":"\"(.+?)\" defined in translator\\.paths does not exist or is not a directory\\.","errorType":"exception","errorClass":"UnexpectedValueException","httpStatus":null,"severity":"error","filePath":"TranslationBundle.php","lineNumber":306,"sourceCode":"            $r = new \\ReflectionClass(AuthenticationException::class);\n\n            $dirs[] = $transPaths[] = \\dirname($r->getFileName(), 2).'/Resources/translations';\n        }\n\n        $parameterBag = $container->getParameterBag();\n\n        foreach ($container->getParameter('kernel.bundles_metadata') as $bundle) {\n            $bundlePath = $parameterBag->unescapeValue($bundle['path']);\n            if ($container->fileExists($dir = $bundlePath.'/Resources/translations') || $container->fileExists($dir = $bundlePath.'/translations')) {\n                $dirs[] = $transPaths[] = $dir;\n            } else {\n                $nonExistingDirs[] = $dir;\n            }\n        }\n\n        foreach ($config['paths'] as $dir) {\n            if (!$container->fileExists($dir)) {\n                throw new \\UnexpectedValueException(\\sprintf('\"%s\" defined in translator.paths does not exist or is not a directory.', $dir));\n            }\n\n            $dirs[] = $transPaths[] = $dir;\n        }\n\n        // the parameter bag returns paths in their escaped form, the filesystem needs the literal one\n        $defaultDir = $parameterBag->unescapeValue($parameterBag->resolveValue($config['default_path']));\n\n        if (null === $defaultDir) {\n            // allow null\n        } elseif ($container->fileExists($defaultDir)) {\n            $dirs[] = $defaultDir;\n        } else {\n            $nonExistingDirs[] = $defaultDir;\n        }\n\n        return [$dirs, $transPaths, $nonExistingDirs];\n    }","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/symfony/translation/blob/ae9e8a51bc29780d63c7f9efd6005d7c875e100b/TranslationBundle.php#L288-L324","documentation":"During DI extension loading, TranslationBundle validates each entry of the translator.paths config with $container->fileExists(). If a configured path does not exist or is not a directory, it throws UnexpectedValueException naming the offending path.","triggerScenarios":"config/packages/translator.yaml contains translator.paths: ['%kernel.project_dir%/translations/custom'] but that directory was never created or was renamed/deleted; a path pointing to a file instead of a directory; cache warmup after a partial deploy.","commonSituations":"New project scaffold where the custom translations dir isn't committed to git; symlinked deployment where the path is missing in production; typo in the configured path.","solutions":["Create the missing directory (mkdir -p) or commit it with a .gitkeep","Fix the path in translator.paths config (typos, wrong kernel.project_dir reference)","Remove the stale path entry from the config"],"exampleFix":"# before (translator.yaml)\ntranslator:\n    paths:\n        - '%kernel.project_dir%/translations/custom'\n# after — either create the dir:\n# mkdir -p translations/custom && touch translations/custom/.gitkeep\n# or fix the path:\ntranslator:\n    paths:\n        - '%kernel.project_dir%/translations'","handlingStrategy":"validation","validationCode":"foreach ($config['paths'] as $dir) {\n    if (!is_dir($dir)) {\n        throw new \\UnexpectedValueException(\"translator.paths entry missing: $dir\");\n    }\n}","typeGuard":"function isTranslationDir(string $dir): bool {\n    return is_dir($dir);\n}","tryCatchPattern":"try {\n    $kernel->boot();\n} catch (\\UnexpectedValueException $e) {\n    if (str_contains($e->getMessage(), 'translator.paths')) {\n        // fix config or create directory, then clear cache\n    }\n    throw $e;\n}","preventionTips":["Commit translation directories to VCS (add .gitkeep)","Validate configured paths in CI before deployment","Avoid referencing symlinks/mounts that may be absent in production","Clear the container cache after changing translator.paths"],"tags":["php","symfony","config"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"ae9e8a51bc29780d63c7f9efd6005d7c875e100b","analyzedAt":"2026-09-15T22:29:15.305Z","contentChangedAt":"2026-09-15T22:29:15.305Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}