{"record":{"id":"ecf115ab25d19f49","repo":"symfony/http-kernel","slug":"mapping-variadic-argument-s-is-not-supported","errorCode":null,"errorMessage":"Mapping variadic argument \"$%s\" is not supported.","messagePattern":"Mapping variadic argument \"\\$(.+?)\" is not supported\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"Controller/ArgumentResolver/RequestPayloadValueResolver.php","lineNumber":91,"sourceCode":"        private readonly ?TranslatorInterface $translator = null,\n        private string $translationDomain = 'validators',\n        private ?ExpressionLanguage $expressionLanguage = null,\n    ) {\n    }\n\n    public function resolve(Request $request, ArgumentMetadata $argument): iterable\n    {\n        $attribute = $argument->getAttributesOfType(MapQueryString::class, ArgumentMetadata::IS_INSTANCEOF)[0]\n            ?? $argument->getAttributesOfType(MapRequestPayload::class, ArgumentMetadata::IS_INSTANCEOF)[0]\n            ?? $argument->getAttributesOfType(MapUploadedFile::class, ArgumentMetadata::IS_INSTANCEOF)[0]\n            ?? null;\n\n        if (!$attribute) {\n            return [];\n        }\n\n        if ($attribute instanceof MapQueryString && $argument->isVariadic()) {\n            throw new \\LogicException(\\sprintf('Mapping variadic argument \"$%s\" is not supported.', $argument->getName()));\n        }\n\n        if ($attribute instanceof MapRequestPayload) {\n            if ('array' === $argument->getType()) {\n                if (!$attribute->type) {\n                    throw new NearMissValueResolverException(\\sprintf('Please set the $type argument of the #[%s] attribute to the type of the objects in the expected array.', MapRequestPayload::class));\n                }\n            } elseif ($attribute->type && !$argument->isVariadic()) {\n                throw new NearMissValueResolverException(\\sprintf('Please set its type to \"array\" when using argument $type of #[%s].', MapRequestPayload::class));\n            }\n        }\n\n        $attribute->metadata = $argument;\n\n        return [$attribute];\n    }\n\n    public function onKernelControllerArguments(ControllerArgumentsEvent $event): void","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/symfony/http-kernel/blob/aa3a39d7286a62cdfea98f0e69c651a3da6e36cf/Controller/ArgumentResolver/RequestPayloadValueResolver.php#L73-L109","documentation":"Symfony throws this LogicException from RequestPayloadValueResolver when a controller argument annotated with #[MapQueryString] (or another non-MapRequestPayload payload attribute) is declared variadic (...$arg). Variadic mapping is only meaningful for MapRequestPayload, so any other payload-mapping attribute on a variadic argument is rejected at resolve time.","triggerScenarios":"Declaring a controller action argument like #[MapQueryString] ...$filters, or any variadic argument carrying a payload attribute other than MapRequestPayload, then dispatching a request to that action.","commonSituations":"Developers try to map multiple query-string segments or repeated payload objects to a variadic parameter, assuming the resolver fans out; the resolver does not support that shape for query string or headers.","solutions":["Remove the variadic (...) declaration from the argument","Use a single typed argument (e.g. an array-backed DTO) instead of variadic","Switch to #[MapRequestPayload] with type set if you actually need an array of mapped objects"],"exampleFix":"// before\npublic function index(#[MapQueryString] Query ...$filters) {}\n// after\npublic function index(#[MapQueryString] QueryFilterList $filters) {}","handlingStrategy":"validation","validationCode":"foreach ($reflParams as $p) { if ($p->isVariadic() && $p->getAttributes(MapQueryString::class)) { throw new \\LogicException($p->name.' must not be variadic'); } }","typeGuard":"if (!$param->isVariadic()) { /* safe to map */ }","tryCatchPattern":"try { $kernel->handle($request); } catch (\\LogicException $e) { if (str_contains($e->getMessage(), 'variadic')) { /* fix controller signature */ } throw $e; }","preventionTips":["Never combine variadic arguments with payload-mapping attributes","Use DTO collections or MapRequestPayload arrays for repeated payloads","Static-analyze controller signatures in CI"],"tags":["symfony","logic-exception","variadic","request-payload"],"backgroundTag":"unsupported-operation","analyzedSha":"aa3a39d7286a62cdfea98f0e69c651a3da6e36cf","analyzedAt":"2026-09-13T18:03:36.509Z","contentChangedAt":"2026-09-13T18:03:36.509Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}