{"record":{"id":"50468c34185baf17","repo":"symfony/translation","slug":"no-loader-is-registered-for-the-s-format","errorCode":null,"errorMessage":"No loader is registered for the \"%s\" format.","messagePattern":"No loader is registered for the \"(.+?)\" format\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"Translator.php","lineNumber":374,"sourceCode":"    {\n        return $this->cacheDir.'/catalogue.'.$locale.'.'.strtr(substr(base64_encode(hash('xxh128', serialize($this->cacheVary), true)), 0, 7), '/', '_').'.php';\n    }\n\n    /**\n     * @internal\n     */\n    protected function doLoadCatalogue(string $locale): void\n    {\n        $this->catalogues[$locale] = new MessageCatalogue($locale);\n\n        if (isset($this->resources[$locale])) {\n            foreach ($this->resources[$locale] as $resource) {\n                if (!isset($this->loaders[$resource[0]])) {\n                    if (\\is_string($resource[1])) {\n                        throw new RuntimeException(\\sprintf('No loader is registered for the \"%s\" format when loading the \"%s\" resource.', $resource[0], $resource[1]));\n                    }\n\n                    throw new RuntimeException(\\sprintf('No loader is registered for the \"%s\" format.', $resource[0]));\n                }\n                $this->catalogues[$locale]->addCatalogue($this->loaders[$resource[0]]->load($resource[1], $locale, $resource[2]));\n            }\n        }\n    }\n\n    private function loadFallbackCatalogues(string $locale): void\n    {\n        $current = $this->catalogues[$locale];\n\n        foreach ($this->computeFallbackLocales($locale) as $fallback) {\n            if (!isset($this->catalogues[$fallback])) {\n                $this->initializeCatalogue($fallback);\n            }\n\n            $fallbackCatalogue = new MessageCatalogue($fallback, $this->getAllMessages($this->catalogues[$fallback]));\n            foreach ($this->catalogues[$fallback]->getResources() as $resource) {\n                $fallbackCatalogue->addResource($resource);","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/symfony/translation/blob/ae9e8a51bc29780d63c7f9efd6005d7c875e100b/Translator.php#L356-L392","documentation":"Same code path as the previous RuntimeException in Translator, thrown when the missing-loader resource is not a string (e.g. an array or object resource), so no resource path can be shown; only the format is reported.","triggerScenarios":"A resource added with a non-string second argument (array/object loader payload) whose format key has no registered loader.","commonSituations":"Custom loader/resource pairs where addLoader() was skipped, or resources defined in config with formats whose loaders are not compiled into the container.","solutions":["Register a loader for that format before adding resources","Verify resource definitions use formats with available loaders","Check container DI wiring for translation loader tags (translation.loader)"],"exampleFix":"// before\n$translator->addResource('csv', $resourceArray, 'fr'); // no csv loader\n// after\n$translator->addLoader('csv', new CsvFileLoader());\n$translator->addResource('csv', $resourceArray, 'fr');","handlingStrategy":"try-catch","validationCode":"$format = $resource[0];\nif (!isset($loaders[$format])) {\n    throw new \\RuntimeException(\"Loader for format '{$format}' is not registered.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    $translator->getCatalogue($locale);\n} catch (RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'No loader is registered')) {\n        // add the loader for the reported format\n    }\n}","preventionTips":["Register loaders for every custom resource format","Audit translation resource definitions for formats with no loader tags","Add an integration test that loads all declared locales once"],"tags":["php","symfony","translation","loader"],"backgroundTag":"missing-dependency","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"}