{"record":{"id":"04ea09de40b16abe","repo":"symfony/translation","slug":"this-is-not-a-local-file-s-icuresfileloader","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/IcuResFileLoader.php","lineNumber":29,"sourceCode":"\nnamespace Symfony\\Component\\Translation\\Loader;\n\nuse Symfony\\Component\\Config\\Resource\\DirectoryResource;\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 IcuResFileLoader implements LoaderInterface\n{\n    public function load(mixed $resource, string $locale, string $domain = 'messages'): MessageCatalogue\n    {\n        if (!stream_is_local($resource)) {\n            throw new InvalidResourceException(\\sprintf('This is not a local file \"%s\".', $resource));\n        }\n\n        if (!is_dir($resource)) {\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/IcuResFileLoader.php#L11-L47","documentation":"IcuResFileLoader::load() checks stream_is_local($resource) and throws InvalidResourceException if the resource directory is not local. This loader loads ICU .res bundles from a local directory via ResourceBundle.","triggerScenarios":"Calling IcuResFileLoader::load($resource, $locale, $domain) with a non-local resource such as a URL or remote stream wrapper path.","commonSituations":"Configured bundle directory uses a remote wrapper (s3://, http://), or a path constant points off the local filesystem.","solutions":["Pass a local directory path containing the .res bundle files.","Sync remote bundle directories to a local temp dir before loading.","Audit config for stream-wrapper prefixes in the resource directory setting.","Create a wrapper loader that stages remote resources locally, then delegates to IcuResFileLoader."],"exampleFix":"// before\n$loader->load('s3://bundles/translations', 'en');\n// after\n$dir = '/tmp/icu-bundles';\nforeach (glob('s3://bundles/translations/*.res') as $f) { copy($f, $dir.'/'.basename($f)); }\n$loader->load($dir, 'en');","handlingStrategy":"validation","validationCode":"if (!stream_is_local($dir)) {\n    throw new \\InvalidArgumentException(\"ICU .res bundle dir must be local: $dir\");\n}","typeGuard":"function isLocalDir(mixed $r): bool { return is_string($r) && stream_is_local($r); }","tryCatchPattern":"try {\n    $catalogue = $loader->load($dir, $locale);\n} catch (Symfony\\Component\\Translation\\Exception\\InvalidResourceException $e) {\n    // sync remote bundles to local dir and retry\n}","preventionTips":["Store .res bundles in a local directory.","Reject remote wrappers in your resource-path config validation.","Stage remote resources to a local cache dir before loading."],"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"}