{"record":{"id":"3e4424b8c4ce73a1","repo":"symfony/translation","slug":"this-is-not-a-local-file-s-icudatfileloader","errorCode":null,"errorMessage":"This is not a local file \"%s\".","messagePattern":"This is not a local file \"(.+?)\"\\.","errorType":"exception","errorClass":"InvalidResourceException","httpStatus":null,"severity":"error","filePath":"Loader/IcuDatFileLoader.php","lineNumber":29,"sourceCode":"\nnamespace Symfony\\Component\\Translation\\Loader;\n\nuse Symfony\\Component\\Config\\Resource\\FileResource;\nuse 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","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/symfony/translation/blob/ae9e8a51bc29780d63c7f9efd6005d7c875e100b/Loader/IcuDatFileLoader.php#L11-L47","documentation":"IcuDatFileLoader::load() checks stream_is_local($resource.'.dat') and throws InvalidResourceException if the .dat bundle file is not local. Note the check is done on the resource with a '.dat' suffix while the message prints the original resource path. Like all Symfony translation file loaders, only local files are supported.","triggerScenarios":"Calling IcuDatFileLoader::load($resource, $locale, $domain) where $resource.'.dat' resolves to a non-local stream, e.g. 'http://host/bundle' or a remote wrapper path.","commonSituations":"Loading ICU resource bundles from a remote or non-local source, misconfigured bundle path with a stream wrapper, or passing a URL to the loader.","solutions":["Ensure the .dat resource bundle resides on the local filesystem and pass its local path.","Copy remote bundle files locally (including all related bundle files) before loading.","Check the configured bundle base path for accidental URL/stream-wrapper prefixes.","Write a custom loader that stages remote bundles into a temp directory first."],"exampleFix":"// before\n$loader->load('http://cdn.example.com/messages', 'en');\n// after\n$loader->load('/app/resources/messages', 'en'); // /app/resources/messages.en.dat must exist locally","handlingStrategy":"validation","validationCode":"if (!stream_is_local($resource.'.dat')) {\n    throw new \\InvalidArgumentException(\"ICU .dat bundle must be local: {$resource}.dat\");\n}","typeGuard":"function isLocalDatBundle(string $base): bool { return stream_is_local($base.'.dat'); }","tryCatchPattern":"try {\n    $catalogue = $loader->load($basePath, $locale);\n} catch (Symfony\\Component\\Translation\\Exception\\InvalidResourceException $e) {\n    // stage remote bundle locally, retry once\n}","preventionTips":["Keep ICU bundles on the local filesystem.","Never pass URLs or remote wrappers to IcuDatFileLoader.","Remember the check runs on $resource.'.dat' — the base path plus .dat must be local."],"tags":["icu","resource-bundle","translation","stream"],"backgroundTag":"invalid-argument-value","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"}