{"record":{"id":"5eb293ff2eb6d8f8","repo":"symfony/translation","slug":"there-is-no-dumper-associated-with-format-s","errorCode":null,"errorMessage":"There is no dumper associated with format \"%s\".","messagePattern":"There is no dumper associated with format \"(.+?)\"\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"Writer/TranslationWriter.php","lineNumber":58,"sourceCode":"     * Obtains the list of supported formats.\n     */\n    public function getFormats(): array\n    {\n        return array_keys($this->dumpers);\n    }\n\n    /**\n     * Writes translation from the catalogue according to the selected format.\n     *\n     * @param string $format  The format to use to dump the messages\n     * @param array  $options Options that are passed to the dumper\n     *\n     * @throws InvalidArgumentException\n     */\n    public function write(MessageCatalogue $catalogue, string $format, array $options = []): void\n    {\n        if (!isset($this->dumpers[$format])) {\n            throw new InvalidArgumentException(\\sprintf('There is no dumper associated with format \"%s\".', $format));\n        }\n\n        // get the right dumper\n        $dumper = $this->dumpers[$format];\n\n        if (isset($options['path']) && !is_dir($options['path']) && !@mkdir($options['path'], 0o777, true) && !is_dir($options['path'])) {\n            throw new RuntimeException(\\sprintf('Translation Writer was not able to create directory \"%s\".', $options['path']));\n        }\n\n        // save\n        $dumper->dump($catalogue, $options);\n    }\n}\n","sourceCodeStart":40,"sourceCodeEnd":72,"githubUrl":"https://github.com/symfony/translation/blob/ae9e8a51bc29780d63c7f9efd6005d7c875e100b/Writer/TranslationWriter.php#L40-L72","documentation":"TranslationWriter::write() looks up the dumper registered for the requested format (e.g. 'xlf', 'yml', 'po'). If no dumper has been added for that format string, it throws this InvalidArgumentException. The writer only knows formats registered via addDumper() or formatDumperClasses.","triggerScenarios":"Calling $writer->write($catalogue, 'xliff', $options) when the dumper was registered as 'xlf' (or vice versa); a typo in the format string; using a format whose dumper class was never added to the writer.","commonSituations":"Migrating from XliffFileDumper/old format names; hard-coding format strings in CI scripts that dump translations; custom dumpers not registered before write().","solutions":["Check the exact format string against $writer->getFormats() before writing","Register the missing dumper: $writer->addDumper('xlf', new XliffFileDumper())","Fix typos (e.g. 'xliff' -> 'xlf')"],"exampleFix":"// before\n$writer->write($catalogue, 'xliff', ['path' => $dir]);\n// after\n$writer->addDumper('xlf', new XliffFileDumper());\nif (in_array('xlf', $writer->getFormats(), true)) {\n    $writer->write($catalogue, 'xlf', ['path' => $dir]);\n}","handlingStrategy":"validation","validationCode":"if (!in_array($format, $writer->getFormats(), true)) {\n    throw new \\InvalidArgumentException(\"Unsupported translation format: $format\");\n}","typeGuard":"function isValidFormat(TranslationWriter $writer, string $format): bool {\n    return in_array($format, $writer->getFormats(), true);\n}","tryCatchPattern":"try {\n    $writer->write($catalogue, $format, $options);\n} catch (\\InvalidArgumentException $e) {\n    $this->logger->error('Unsupported translation format', ['format' => $format, 'msg' => $e->getMessage()]);\n}","preventionTips":["Always derive format strings from TranslationWriter::getFormats() rather than hardcoding","Register all dumpers before calling write()","Use class constants for format names in shared code"],"tags":["php","translation","invalid-argument"],"backgroundTag":"invalid-enum-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"}