{"record":{"id":"4583aaf32dbceae9","repo":"rectorphp/rector","slug":"output-formatter-s-was-not-found-pick-one-of","errorCode":null,"errorMessage":"Output formatter \"%s\" was not found. Pick one of \"%s\".","messagePattern":"Output formatter \"(.+?)\" was not found\\. Pick one of \"(.+?)\"\\.","errorType":"validation","errorClass":"InvalidConfigurationException","httpStatus":null,"severity":"error","filePath":"src/Console/Output/OutputFormatterCollector.php","lineNumber":34,"sourceCode":"     */\n    public function __construct(iterable $outputFormatters)\n    {\n        foreach ($outputFormatters as $outputFormatter) {\n            $this->outputFormatters[$outputFormatter->getName()] = $outputFormatter;\n        }\n    }\n    public function getByName(string $name): OutputFormatterInterface\n    {\n        $this->ensureOutputFormatExists($name);\n        return $this->outputFormatters[$name];\n    }\n    private function ensureOutputFormatExists(string $name): void\n    {\n        if (isset($this->outputFormatters[$name])) {\n            return;\n        }\n        $outputFormatterNames = array_keys($this->outputFormatters);\n        throw new InvalidConfigurationException(sprintf('Output formatter \"%s\" was not found. Pick one of \"%s\".', $name, implode('\", \"', $outputFormatterNames)));\n    }\n}\n","sourceCodeStart":16,"sourceCodeEnd":37,"githubUrl":"https://github.com/rectorphp/rector/blob/408fcb0ff1833e3d26cbc9b04c23a77565814a16/src/Console/Output/OutputFormatterCollector.php#L16-L37","documentation":"OutputFormatterCollector::getByName() looks up the formatter tagged service matching the requested name (typically from --output-format on the CLI). When no registered formatter carries that name, ensureOutputFormatExists() throws InvalidConfigurationException and embeds the sorted list of names that ARE registered, so the message itself is the discovery mechanism.","triggerScenarios":"Running vendor/bin/rector process src --output-format=json (typo, unregistered, or not-installed formatter); calling OutputFormatterCollector::getByName('xml') programmatically when only other formatters are tagged in the container.","commonSituations":"Expecting a JSON/JUnit formatter that lives in a separate package that is not installed; typos like '--output-format=none ' with trailing whitespace; CI pipelines hard-coding a formatter name that a Rector upgrade renamed.","solutions":["Read the exception message: it lists every registered formatter name in quotes","Switch --output-format to one of the listed names (typically 'none' in the minimal install)","composer require the package that provides the formatter you want and re-run so its service gets tagged","Check for typos/whitespace in the CLI option value"],"exampleFix":"// before\n$ vendor/bin/rector process src --output-format=xml\n// Output formatter \"xml\" was not found. Pick one of \"none\".\n\n// after\n$ vendor/bin/rector process src --output-format=none","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    $formatter = $outputFormatterCollector->getByName($requestedName);\n} catch (InvalidConfigurationException $e) {\n    // message lists valid names: pick a safe default instead of aborting\n    $formatter = $outputFormatterCollector->getByName('none');\n}","preventionTips":["Run vendor/bin/rector process --output-format once to see registered names before wiring CI","Fail fast in wrappers: reject unknown --output-format values before the container boots","Treat the quoted list inside the exception message as the API contract after each Rector upgrade"],"tags":["php","rector","cli","output-format","service-lookup"],"backgroundTag":"unknown-output-format","analyzedSha":"408fcb0ff1833e3d26cbc9b04c23a77565814a16","analyzedAt":"2026-08-21T05:11:02.643Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}