{"record":{"id":"30d93af04123434f","repo":"symfony/symfony","slug":"the-options-tags-tag-parameters-parameter-cann-30d93a","errorCode":null,"errorMessage":"The options tags, tag, parameters & parameter cannot be combined together.","messagePattern":"The options tags, tag, parameters & parameter cannot be combined together\\.","errorType":"console","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php","lineNumber":270,"sourceCode":"     *\n     * @throws \\InvalidArgumentException\n     */\n    protected function validateInput(InputInterface $input): void\n    {\n        $options = ['tags', 'tag', 'parameters', 'parameter'];\n\n        $optionsCount = 0;\n        foreach ($options as $option) {\n            if ($input->getOption($option)) {\n                ++$optionsCount;\n            }\n        }\n\n        $name = $input->getArgument('name');\n        if ((null !== $name) && ($optionsCount > 0)) {\n            throw new InvalidArgumentException('The options tags, tag, parameters & parameter cannot be combined with the service name argument.');\n        } elseif ((null === $name) && $optionsCount > 1) {\n            throw new InvalidArgumentException('The options tags, tag, parameters & parameter cannot be combined together.');\n        }\n    }\n\n    private function findProperServiceName(InputInterface $input, SymfonyStyle $io, ContainerBuilder $container, string $name, bool $showHidden): string\n    {\n        $name = ltrim($name, '\\\\');\n\n        if ($container->has($name) || !$input->isInteractive()) {\n            return $name;\n        }\n\n        $matchingServices = $this->findServiceIdsContaining($container, $name, $showHidden);\n        if (!$matchingServices) {\n            throw new InvalidArgumentException(\\sprintf('No services found that match \"%s\".', $name));\n        }\n\n        if (1 === \\count($matchingServices)) {\n            return $matchingServices[0];","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/symfony/symfony/blob/698e28026c22cf35d032cdb6e800db48b1535790/src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php#L252-L288","documentation":"Thrown by `ContainerDebugCommand::validateInput()` when more than one of the listing options (`--tags`, `--tag`, `--parameters`, `--parameter`) is supplied simultaneously without a service name argument. The command can only describe one category of container data at a time, so combining them is rejected up front.","triggerScenarios":"Running e.g. `php bin/console debug:container --tags --parameters`, `--tag=form.type --parameter=kernel.debug`, or any pair of the four listing options in a single invocation.","commonSituations":"Copy-pasting command flags from different recipes, shell history tab-completion bringing in a stale option, or wrapper scripts that blindly concatenate options.","solutions":["Run separate commands for each piece of information you need.","Pick the single most relevant option and remove the others from the command line."],"exampleFix":"// before\nphp bin/console debug:container --tags --parameters\n\n// after\nphp bin/console debug:container --tags\nphp bin/console debug:container --parameters","handlingStrategy":"validation","validationCode":"// Enforce at most one listing option before running.\n$exclusiveOpts = ['tags','tag','parameters','parameter'];\n$used = array_filter($exclusiveOpts, fn($o) => $input->getOption($o));\nif (count($used) > 1) {\n    // pick the first and drop the rest, or reject\n}","typeGuard":null,"tryCatchPattern":"try {\n    $command->run($input, $output);\n} catch (\\Symfony\\Component\\Console\\Exception\\InvalidArgumentException $e) {\n    // inform user to choose a single option\n}","preventionTips":["Remember the four listing options are mutually exclusive by design.","Build separate one-purpose command aliases/scripts rather than combined invocations."],"tags":["symfony","console","cli-usage","validation"],"analyzedSha":"698e28026c22cf35d032cdb6e800db48b1535790","analyzedAt":"2026-08-06T23:40:49.025Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}