{"record":{"id":"cfce2f5d627ae6e7","repo":"symfony/translation","slug":"file-s-not-found-xlifffileloader","errorCode":null,"errorMessage":"File \"%s\" not found.","messagePattern":"File \"(.+?)\" not found\\.","errorType":"exception","errorClass":"NotFoundResourceException","httpStatus":null,"severity":"error","filePath":"Loader/XliffFileLoader.php","lineNumber":44,"sourceCode":" * XliffFileLoader loads translations from XLIFF files.\n *\n * @author Fabien Potencier <fabien@symfony.com>\n */\nclass XliffFileLoader implements LoaderInterface\n{\n    public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue\n    {\n        if (!class_exists(XmlUtils::class)) {\n            throw new RuntimeException('Loading translations from the Xliff format requires the Symfony Config component.');\n        }\n\n        if (!$this->isXmlString($resource)) {\n            if (!stream_is_local($resource)) {\n                throw new InvalidResourceException(\\sprintf('This is not a local file \"%s\".', $resource));\n            }\n\n            if (!file_exists($resource)) {\n                throw new NotFoundResourceException(\\sprintf('File \"%s\" not found.', $resource));\n            }\n\n            if (!is_file($resource)) {\n                throw new InvalidResourceException(\\sprintf('This is neither a file nor an XLIFF string \"%s\".', $resource));\n            }\n        }\n\n        try {\n            if ($this->isXmlString($resource)) {\n                $dom = XmlUtils::parse($resource);\n            } else {\n                $dom = XmlUtils::loadFile($resource);\n            }\n        } catch (\\InvalidArgumentException|XmlParsingException|InvalidXmlException $e) {\n            throw new InvalidResourceException(\\sprintf('Unable to load \"%s\": ', $resource).$e->getMessage(), $e->getCode(), $e);\n        }\n\n        if ($errors = XliffUtils::validateSchema($dom)) {","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/symfony/translation/blob/ae9e8a51bc29780d63c7f9efd6005d7c875e100b/Loader/XliffFileLoader.php#L26-L62","documentation":"After confirming the resource is a local stream, the loader checks file_exists(); a path that does not exist raises NotFoundResourceException. It is the standard 'translation file missing' error of the XLIFF loader.","triggerScenarios":"Passing a local path to XliffFileLoader::load() where no file exists, e.g. a wrong directory, a locale/domain naming mistake, or a file deleted before load.","commonSituations":"Typo in translations directory configuration; deploy step that skips translation files; case-sensitive filesystems where Messages.EN.xlf != messages.en.xlf.","solutions":["Verify the file exists at the exact path with file_exists($resource) before calling load().","Fix the path/typo or the configured translation directory (%kernel.project_dir%/translations in Symfony).","Check file name case matches exactly on case-sensitive filesystems.","Ensure your deployment/build copies the translation files to the target environment."],"exampleFix":"// before\n$loader->load('translations/messages.en.xlf', 'en'); // file actually at app/translations/\n// after\n$loader->load('app/translations/messages.en.xlf', 'en');","handlingStrategy":"validation","validationCode":"if (!file_exists($resource)) {\n    throw new \\RuntimeException(sprintf('Translation file missing: %s', $resource));\n}","typeGuard":null,"tryCatchPattern":"try {\n    $catalogue = $loader->load($resource, $locale);\n} catch (NotFoundResourceException $e) {\n    $this->logger->warning('Missing translation file', ['file' => $resource]);\n    return new MessageCatalogue($locale);\n}","preventionTips":["Check file_exists() before load() in deployment-critical paths.","Verify translation files are included in deploy artifacts and Docker images.","Be careful with filename case on Linux production servers.","Log and test expected translation file paths at boot."],"tags":["php","xliff","file-not-found"],"backgroundTag":"file-not-found","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"}