{"record":{"id":"f910d019c8949ed9","repo":"symfony/translation","slug":"file-s-not-found-icudatfileloader","errorCode":null,"errorMessage":"File \"%s\" not found.","messagePattern":"File \"(.+?)\" not found\\.","errorType":"exception","errorClass":"NotFoundResourceException","httpStatus":null,"severity":"error","filePath":"Loader/IcuDatFileLoader.php","lineNumber":33,"sourceCode":"use Symfony\\Component\\Translation\\Exception\\InvalidResourceException;\nuse Symfony\\Component\\Translation\\Exception\\NotFoundResourceException;\nuse Symfony\\Component\\Translation\\MessageCatalogue;\n\n/**\n * IcuResFileLoader loads translations from a resource bundle.\n *\n * @author stealth35\n */\nclass IcuDatFileLoader extends IcuResFileLoader\n{\n    public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue\n    {\n        if (!stream_is_local($resource.'.dat')) {\n            throw new InvalidResourceException(\\sprintf('This is not a local file \"%s\".', $resource));\n        }\n\n        if (!file_exists($resource.'.dat')) {\n            throw new NotFoundResourceException(\\sprintf('File \"%s\" not found.', $resource));\n        }\n\n        try {\n            $rb = new \\ResourceBundle($locale, $resource);\n        } catch (\\Exception) {\n            $rb = null;\n        }\n\n        if (!$rb) {\n            throw new InvalidResourceException(\\sprintf('Cannot load resource \"%s\".', $resource));\n        } elseif (intl_is_failure($rb->getErrorCode())) {\n            throw new InvalidResourceException($rb->getErrorMessage(), $rb->getErrorCode());\n        }\n\n        $messages = $this->flatten($rb);\n        $catalogue = new MessageCatalogue($locale);\n        $catalogue->add($messages, $domain);\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/symfony/translation/blob/ae9e8a51bc29780d63c7f9efd6005d7c875e100b/Loader/IcuDatFileLoader.php#L15-L51","documentation":"Resource guard in IcuDatFileLoader::load(): the compiled ICU resource bundle file '<resource>.dat' does not exist or is not readable (the loader appends the .dat extension to the given path before checking), so it raises NotFoundResourceException before attempting to parse the bundle with ResourceBundle.","triggerScenarios":"Calling IcuDatFileLoader::load('/path/bundle', 'en') when '/path/bundle.en.dat' (the .dat file referenced by ResourceBundle) does not exist locally.","commonSituations":"ICU bundles not packaged with the application, bundle built for a different naming scheme, files stripped during deployment, or passing the .dat file itself instead of the bundle base path.","solutions":["Generate the .dat resource bundle for the locale (e.g. with genrb and icupkg/derb conversion) and place it at the expected path.","Verify the path passed to load() points at the bundle without the .dat suffix — the loader appends it automatically.","Check filesystem permissions and that the file is local (stream_is_local requirement)."],"exampleFix":"// before\n$loader->load('/app/resources/messages.en.dat', 'en'); // loader appends .dat again\n// after\n$loader->load('/app/resources/messages', 'en'); // expects /app/resources/messages.en.dat to exist","handlingStrategy":"fallback","validationCode":"$datFile = $basePath.'.'.$locale.'.dat';\nif (!file_exists($datFile)) {\n    throw new \\RuntimeException(\"Missing ICU bundle: $datFile\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    $catalogue = $loader->load($basePath, $locale);\n} catch (Symfony\\Component\\Translation\\Exception\\NotFoundResourceException $e) {\n    $catalogue = $loader->load($basePath, $fallbackLocale);\n}","preventionTips":["Ship the compiled .dat bundles with the application.","Pass the bundle base path, not the .dat file path.","Compile bundles in the build pipeline so they are never stale or missing.","Verify bundle presence in a deployment smoke test."],"tags":["icu","resource-bundle","file-not-found","translation"],"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"}