{"record":{"id":"ec52e2da28a7cddd","repo":"octobercms/october","slug":"the-s-modifier-takes-exactly-one-argument-0-gi","errorCode":null,"errorMessage":"The \"%s\" modifier takes exactly one argument (0 given).","messagePattern":"The \"(.+?)\" modifier takes exactly one argument \\(0 given\\)\\.","errorType":"exception","errorClass":"Twig\\Error\\SyntaxError","httpStatus":null,"severity":"error","filePath":"modules/cms/twig/tokenparser/CacheTokenParser.php","lineNumber":36,"sourceCode":"     * @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            }\n        }\n\n        $stream->expect(Token::BLOCK_END_TYPE);\n        $body = $this->parser->subparse([$this, 'decideCacheEnd'], true);\n        $stream->expect(Token::BLOCK_END_TYPE);\n\n        $body = new CacheNode($key, $ttl, $body, $token->getLine());","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/cms/twig/tokenparser/CacheTokenParser.php#L18-L54","documentation":"The ttl modifier of the {% cache %} tag requires exactly one argument. If the parser sees the closing parenthesis immediately after the opening one, it throws this SyntaxError - the TTL value was omitted entirely ({% cache 'key' ttl() %}).","triggerScenarios":"Writing {% cache 'sidebar' ttl() %} with empty parentheses during template compilation; typically a placeholder that was never filled in or a copy-paste that lost the value.","commonSituations":"Template scaffolding left with an empty ttl(); refactoring that removed the value but kept the parens; misunderstanding ttl as a flag.","solutions":["Supply a single TTL value in minutes: {% cache 'sidebar' ttl(3600) %}.","If you want the default TTL, drop the modifier entirely: {% cache 'sidebar' %}.","Re-save the template and reload - the error is compile-time, so the page will not render until fixed."],"exampleFix":"{# before #}\n{% cache 'sidebar' ttl() %}\n\n{# after #}\n{% cache 'sidebar' ttl(3600) %}","handlingStrategy":"validation","validationCode":"$env = app('twig.environment');\ntry {\n    $env->parse($env->tokenize(new \\Twig\\Source($templateBody, $fileName)));\n} catch (\\Twig\\Error\\SyntaxError $e) {\n    // reject empty ttl() before the template reaches production\n}","typeGuard":null,"tryCatchPattern":"try {\n    $env->parse($env->tokenize(new \\Twig\\Source($body, $name)));\n} catch (\\Twig\\Error\\SyntaxError $e) {\n    // flag 'takes exactly one argument (0 given)' for immediate fix\n}","preventionTips":["Never leave placeholder ttl() in scaffolds - omit the modifier for the default TTL.","Review diff hunks containing cache tags before merging.","Run a template lint step on save in your editor or CI."],"tags":["twig","syntax-error","cache-tag","template","missing-argument"],"backgroundTag":"template-syntax-error","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}