{"record":{"id":"782fc3e6ada9ec9c","repo":"twigphp/Twig","slug":"unknown-s-configuration","errorCode":null,"errorMessage":"Unknown \"%s\" configuration.","messagePattern":"Unknown \"(.+?)\" configuration\\.","errorType":"exception","errorClass":"Twig\\Error\\SyntaxError","httpStatus":null,"severity":"error","filePath":"extra/cache-extra/TokenParser/CacheTokenParser.php","lineNumber":34,"sourceCode":"use Twig\\Node\\Expression\\Filter\\RawFilter;\nuse Twig\\Node\\Node;\nuse Twig\\Node\\PrintNode;\nuse Twig\\Token;\nuse Twig\\TokenParser\\AbstractTokenParser;\n\nclass CacheTokenParser extends AbstractTokenParser\n{\n    public function parse(Token $token): Node\n    {\n        $stream = $this->parser->getStream();\n        $key = $this->parser->parseExpression();\n\n        $ttl = null;\n        $tags = null;\n        while ($stream->test(Token::NAME_TYPE)) {\n            $k = $stream->getCurrent()->getValue();\n            if (!\\in_array($k, ['ttl', 'tags'], true)) {\n                throw new SyntaxError(\\sprintf('Unknown \"%s\" configuration.', $k), $stream->getCurrent()->getLine(), $stream->getSourceContext());\n            }\n\n            $stream->next();\n            $stream->expect(Token::OPERATOR_TYPE, '(');\n            $line = $stream->getCurrent()->getLine();\n            if ($stream->test(Token::PUNCTUATION_TYPE, ')')) {\n                throw new SyntaxError(\\sprintf('The \"%s\" modifier takes exactly one argument (0 given).', $k), $line, $stream->getSourceContext());\n            }\n            $arg = $this->parser->parseExpression();\n            if ($stream->test(Token::PUNCTUATION_TYPE, ',')) {\n                throw new SyntaxError(\\sprintf('The \"%s\" modifier takes exactly one argument (2 given).', $k), $line, $stream->getSourceContext());\n            }\n            $stream->expect(Token::PUNCTUATION_TYPE, ')');\n\n            if ('ttl' === $k) {\n                $ttl = $arg;\n            } elseif ('tags' === $k) {\n                $tags = $arg;","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/twigphp/Twig/blob/a414c3a491defb5a60f2fc88ef79ff37c90010cd/extra/cache-extra/TokenParser/CacheTokenParser.php#L16-L52","documentation":"This Twig SyntaxError is thrown by CacheTokenParser::parse while parsing a {% cache %} tag. The tag only accepts two named modifiers, 'ttl' and 'tags'; any other name token inside the tag is rejected at compile time with the offending key name in the message. It is a template compile-time guard against misspelled or unsupported cache options.","triggerScenarios":"Writing a {% cache %} tag with a modifier name other than 'ttl' or 'tags', e.g. {% cache lifetime=60 %} or {% cache key=\"foo\" %} or a typo like {% cache ttll=60 %}.","commonSituations":"Developers migrating from other caching bundles expecting a 'key' or 'lifetime' option, or simply typo-ing 'ttl'/'tags' inside the cache tag.","solutions":["Replace the unknown modifier with one of the supported ones: 'ttl' or 'tags'.","Check the exact spelling of the modifier name inside the {% cache %} tag.","Consult the cache-extra documentation for the supported tag syntax.","If you need extra behavior (e.g. cache keys), use an expression inside ttl/tags arguments or wrap the block differently."],"exampleFix":"// before\n{% cache lifetime=60 %}...{% endcache %}\n// after\n{% cache ttl=60 %}...{% endcache %}","handlingStrategy":"validation","validationCode":"$allowed = ['ttl', 'tags'];\nif (!in_array($modifier, $allowed, true)) {\n    throw new InvalidArgumentException(sprintf('Modifier must be one of: %s, got \"%s\"', implode(', ', $allowed), $modifier));\n}","typeGuard":null,"tryCatchPattern":"try {\n    $twig->render($template);\n} catch (\\Twig\\Error\\SyntaxError $e) {\n    if (str_contains($e->getMessage(), 'Unknown')) {\n        // log template name + line, surface fix to developer\n    }\n    throw $e;\n}","preventionTips":["Only use ttl and tags modifiers inside {% cache %} tags","Add template linting (twigcs or twig lint) to CI to catch bad tags before deploy","Copy syntax from the cache-extra documentation, not from memory"],"tags":["twig","template-syntax","cache-extension","compile-time"],"backgroundTag":"invalid-config-value","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"}