{"record":{"id":"a3a92c7967ab1887","repo":"symfony/symfony","slug":"did-you-forget-to-run-composer-require-s-unkno","errorCode":null,"errorMessage":"Did you forget to run \"composer require %s\"? Unknown %s \"%s\".","messagePattern":"Did you forget to run \"composer require (.+?)\"\\? Unknown (.+?) \"(.+?)\"\\.","errorType":"exception","errorClass":"Twig\\Error\\SyntaxError","httpStatus":null,"severity":"error","filePath":"src/Symfony/Bridge/Twig/UndefinedCallableHandler.php","lineNumber":101,"sourceCode":"        'workflow_transition_blockers' => 'workflow',\n    ];\n\n    private const FULL_STACK_ENABLE = [\n        'html-sanitizer' => 'enable \"framework.html_sanitizer\"',\n        'form' => 'enable \"framework.form\"',\n        'security-core' => 'add the \"SecurityBundle\"',\n        'security-http' => 'add the \"SecurityBundle\"',\n        'web-link' => 'enable \"framework.web_link\"',\n        'workflow' => 'enable \"framework.workflows\"',\n    ];\n\n    public static function onUndefinedFilter(string $name): TwigFilter|false\n    {\n        if (!isset(self::FILTER_COMPONENTS[$name])) {\n            return false;\n        }\n\n        throw new SyntaxError(self::onUndefined($name, 'filter', self::FILTER_COMPONENTS[$name]));\n    }\n\n    public static function onUndefinedFunction(string $name): TwigFunction|false\n    {\n        if (!isset(self::FUNCTION_COMPONENTS[$name])) {\n            return false;\n        }\n\n        if ('webpack-encore-bundle' === self::FUNCTION_COMPONENTS[$name]) {\n            return new TwigFunction($name, static fn () => '');\n        }\n\n        throw new SyntaxError(self::onUndefined($name, 'function', self::FUNCTION_COMPONENTS[$name]));\n    }\n\n    private static function onUndefined(string $name, string $type, string $component): string\n    {\n        if (class_exists(FullStack::class) && isset(self::FULL_STACK_ENABLE[$component])) {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/symfony/symfony/blob/698e28026c22cf35d032cdb6e800db48b1535790/src/Symfony/Bridge/Twig/UndefinedCallableHandler.php#L83-L119","documentation":"Thrown by Twig's undefined-callable handler when an undefined Twig filter that Symfony recognizes as belonging to a known component is invoked. The handler maps filters like 'trans', 'serialize', 'emojify', 'humanize', 'normalize', 'sanitize_html', 'yaml_encode/dump', 'form_encode_currency' to their providing package and tells you which composer package to install (or, in full-stack, which config to enable).","triggerScenarios":"Using a Twig filter (e.g. {{ x|trans }}, {{ data|serialize }}, {{ md|sanitize_html }}) in a template while the corresponding Symfony component (symfony/translation, symfony/serializer, symfony/html-sanitizer) is not installed, or the Twig bridge extension is not registered.","commonSituations":"Starting a new project and using translation/serializer/emoji filters without requiring the package. Removing a dependency but leaving template filters referencing it. The package is installed but the bridge extension isn't wired into the Twig environment.","solutions":["Run the suggested composer require command, e.g. composer require symfony/translation for the 'trans' filter.","If the package is already installed (InstalledVersions::isInstalled returns true), the handler points to symfony/twig-bundle — install/register twig-bundle so the extension is loaded.","For full-stack Symfony, enable the relevant framework config (e.g. framework.html_sanitizer) instead of installing a package."],"exampleFix":"# before: filter 'trans' is undefined\ncomposer require symfony/translation\n# then clear cache: php bin/console cache:clear","handlingStrategy":"validation","validationCode":"// Ensure the component is installed before relying on a filter\nuse Composer\\InstalledVersions;\nif (!InstalledVersions::isInstalled('symfony/translation')) {\n    throw new \\LogicException('Install symfony/translation to use the trans filter.');\n}","typeGuard":null,"tryCatchPattern":"try {\n    $twig->render($template, $vars);\n} catch (\\Twig\\Error\\SyntaxError $e) {\n    if (str_contains($e->getMessage(), 'composer require')) {\n        // parse suggested package, install it, clear cache, retry\n    }\n    throw $e;\n}","preventionTips":["Require components (symfony/translation, symfony/serializer, etc.) when you use their Twig filters.","Ensure symfony/twig-bundle is registered so bridge extensions load.","Lint templates in CI after dependency changes."],"tags":["twig","missing-dependency","composer","filter","bridge"],"analyzedSha":"698e28026c22cf35d032cdb6e800db48b1535790","analyzedAt":"2026-08-06T23:40:49.025Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}