{"record":{"id":"eda0f83bd0435202","repo":"twigphp/Twig","slug":"unknown-argument-s-s-for-s-s-s-callableargumentsextractor","errorCode":null,"errorMessage":"Unknown argument%s \"%s\" for %s \"%s(%s)\".","messagePattern":"Unknown argument(.+?) \"(.+?)\" for (.+?) \"(.+?)\\((.+?)\\)\"\\.","errorType":"exception","errorClass":"SyntaxError","httpStatus":null,"severity":"error","filePath":"src/Util/CallableArgumentsExtractor.php","lineNumber":161,"sourceCode":"                unset($extractedArguments[$key]);\n            }\n\n            if ($arbitraryArguments->count()) {\n                $arguments = array_merge($arguments, $optionalArguments);\n                $arguments[] = $arbitraryArguments;\n            }\n        }\n\n        if ($extractedArguments) {\n            $unknownArgument = null;\n            foreach ($extractedArguments as $extractedArgument) {\n                if ($extractedArgument instanceof Node) {\n                    $unknownArgument = $extractedArgument;\n                    break;\n                }\n            }\n\n            throw new SyntaxError(\n                \\sprintf(\n                    'Unknown argument%s \"%s\" for %s \"%s(%s)\".',\n                    \\count($extractedArguments) > 1 ? 's' : '', implode('\", \"', array_keys($extractedArguments)), $this->twigCallable->getType(), $this->twigCallable->getName(), implode(', ', array_map([$this, 'toSnakeCase'], $callableParameterNames))\n                ),\n                $unknownArgument ? $unknownArgument->getTemplateLine() : $this->node->getTemplateLine(),\n                $unknownArgument ? $unknownArgument->getSourceContext() : $this->node->getSourceContext()\n            );\n        }\n\n        return $arguments;\n    }\n\n    private function normalizeName(string $name): string\n    {\n        return strtolower(str_replace('_', '', $name));\n    }\n\n    private function toSnakeCase(string $name): string","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/twigphp/Twig/blob/a414c3a491defb5a60f2fc88ef79ff37c90010cd/src/Util/CallableArgumentsExtractor.php#L143-L179","documentation":"After mapping all supplied arguments onto the callable's known parameters, extractArguments() throws this SyntaxError for leftover arguments that match no parameter — listing all unknown argument names, the callable's type, name, and its accepted parameter list. Pluralization and the offending argument's line are computed for a precise compile-time message.","triggerScenarios":"Passing a named argument that does not match (after normalization) any parameter of the function/filter/test, e.g. {{ date(timezone='UTC') }} on a callable with no $timezone parameter, or an unknown filter option.","commonSituations":"Typo'd option names (case or underscore variants that don't normalize); upgrading a library where a callable's parameters were renamed or removed; mixing up similarly named functions with different signatures.","solutions":["Fix or remove the unknown argument named in the message; the accepted parameters are listed in the error.","Check the callable's signature after any dependency upgrade — parameters may have been renamed.","If the callable should accept the option, add the corresponding parameter to the extension's callable."],"exampleFix":"{# before #}\n{{ 'x'|upper(strict=true) }}\n{# after: upper takes no options #}\n{{ 'x'|upper }}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    $out = $twig->render($template, $ctx);\n} catch (Twig\\Error\\SyntaxError $e) {\n    if (preg_match('/Unknown arguments? \"([^\"]+)\" for/', $e->getMessage(), $m)) {\n        error_log('Unknown option \"'.$m[1].'\" at line '.$e->getTemplateLine().' — check accepted parameters in the message');\n    }\n    throw $e;\n}","preventionTips":["Copy argument names from the callable's documented signature; watch for typos and casing.","After upgrading libraries, grep templates for options of changed callables and verify against new signatures.","Use bin/console lint:twig (or twig linter) in CI so unknown arguments fail the build, not production."],"tags":["twig","unknown-argument","compile-time","syntax-error"],"backgroundTag":"unknown-argument","analyzedSha":"a414c3a491defb5a60f2fc88ef79ff37c90010cd","analyzedAt":"2026-09-13T15:10:46.849Z","contentChangedAt":"2026-09-13T15:10:46.849Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}