octobercms/october · error · TwigErrorSyntax

Invalid syntax in the put tag. Line %s

Error message

Invalid syntax in the put tag. Line %s

What it means

Error "Invalid syntax in the put tag. Line %s" thrown in octobercms/october.

Source

Thrown at modules/cms/twig/tokenparser/PutTokenParser.php:67

        else {
            // Capture mode
            $capture = true;

            if (count($names) > 1) {
                throw new TwigErrorSyntax(
                    'When using put with a block, you cannot have multiple targets.',
                    $stream->getCurrent()->getLine(),
                    $stream->getSourceContext()
                );
            }

            while (!$stream->test(TwigToken::BLOCK_END_TYPE)) {
                $current = $stream->next();
                if ($current->test(TwigToken::NAME_TYPE)) {
                    $options[] = strtolower(trim($current->getValue()));
                }
                else {
                    throw new TwigErrorSyntax(
                        sprintf('Invalid syntax in the put tag. Line %s', $lineno),
                        $stream->getCurrent()->getLine(),
                        $stream->getSourceContext()
                    );
                }
            }

            $stream->expect(TwigToken::BLOCK_END_TYPE);
            $values = $this->parser->subparse([$this, 'decidePutEnd'], true);

            // Deprecated usage: {% endput overwrite %}
            if ($stream->test(TwigToken::NAME_TYPE)) {
                $options[] = $stream->next()->getValue();
            }

            $stream->expect(TwigToken::BLOCK_END_TYPE);
        }

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/cms/twig/tokenparser/PutTokenParser.php:67 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/9d93c98976fa98f7. Report an issue: GitHub.