{"record":{"id":"21339fb1ec2368f2","repo":"octobercms/october","slug":"unknown-s-configuration","errorCode":null,"errorMessage":"Unknown \"%s\" configuration.","messagePattern":"Unknown \"(.+?)\" configuration\\.","errorType":"exception","errorClass":"Twig\\Error\\SyntaxError","httpStatus":null,"severity":"error","filePath":"modules/cms/twig/tokenparser/CacheTokenParser.php","lineNumber":29,"sourceCode":"/**\n * CacheTokenParser\n */\nclass CacheTokenParser extends AbstractTokenParser\n{\n    /**\n     * Parses a token and returns a node.\n     * @return PartialNode\n     */\n    public function parse(Token $token): Node\n    {\n        $stream = $this->parser->getStream();\n        $key = $this->parser->parseExpression();\n\n        $ttl = null;\n        while ($stream->test(Token::NAME_TYPE)) {\n            $k = $stream->getCurrent()->getValue();\n            if (!in_array($k, ['ttl'], 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\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 ($k === 'ttl') {\n                $ttl = $arg;\n            }","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/twig/tokenparser/CacheTokenParser.php#L11-L47","documentation":"The {% cache %} tag parses one key expression followed by optional modifiers, and the only supported modifier name is ttl. While parsing, any other NAME token after the key throws this Twig SyntaxError at compile time - e.g. an attempt to configure expiry with a different word (expire, timeout, time, seconds).","triggerScenarios":"Writing {% cache 'sidebar' timeout(60) %} or {% cache 'key' ttl(3600) seconds(30) %} - any modifier token whose value is not 'ttl' hits the in_array($k, ['ttl']) rejection during template compilation.","commonSituations":"Developers guessing modifier names from other cache APIs; copy-pasting tags from tutorials targeting different CMS versions; adding unsupported options like scope or tags to the tag.","solutions":["Remove the unknown modifier - ttl is the only one this tag accepts.","Spell the modifier exactly ttl: {% cache 'sidebar' ttl(3600) %} (minutes).","Move any other behaviour (key namespacing, invalidation) into the key expression or application code."],"exampleFix":"{# before #}\n{% cache 'sidebar' ttl(3600) timeout(60) %}\n\n{# after: ttl is the only supported modifier #}\n{% cache 'sidebar' ttl(3600) %}","handlingStrategy":"validation","validationCode":"// Lint a CMS template body before saving/deploying it\nuse Twig\\Source;\n\n$env = app('twig.environment'); // the CMS Twig instance with October's tags\ntry {\n    $env->parse($env->tokenize(new Source($templateBody, $fileName)));\n} catch (\\Twig\\Error\\SyntaxError $e) {\n    // reject the save: message includes the unknown modifier and line\n}","typeGuard":null,"tryCatchPattern":"try {\n    echo twig_render($template);\n} catch (\\Twig\\Error\\SyntaxError $e) {\n    // compile-time failure: report $e->getMessage() with line, fix the tag\n}","preventionTips":["Remember {% cache key ttl(n) %} supports exactly one modifier: ttl.","Lint templates through Twig's parser in CI before deploy.","When copying tags from docs, match them against the version you run."],"tags":["twig","syntax-error","cache-tag","template"],"backgroundTag":"template-syntax-error","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}