octobercms/october · error · Twig\Error\SyntaxError

Invalid syntax in the partial tag. Line %s

Error message

Invalid syntax in the partial tag. Line %s

What it means

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

Source

Thrown at modules/cms/twig/tokenparser/PartialTokenParser.php:85

                continue;
            }

            if ($current->test(TwigToken::NAME_TYPE)) {
                $paramName = $current->getValue();

                // Support hyphenated attribute names like `data-testid` and `aria-label`.
                // Twig tokenizes them as NAME `-` NAME ..., so consume the pieces until `=`.
                while ($stream->test(TwigToken::OPERATOR_TYPE, '-')) {
                    $stream->next();
                    $paramName .= '-' . $stream->expect(TwigToken::NAME_TYPE)->getValue();
                }

                $stream->expect(TwigToken::OPERATOR_TYPE, '=');
                $nodes[$paramName] = $this->parser->parseExpression();
                $paramNames[] = $paramName;
            }
            else {
                throw new TwigErrorSyntax(
                    sprintf('Invalid syntax in the partial tag. Line %s', $lineno),
                    $stream->getCurrent()->getLine(),
                    $stream->getSourceContext()
                );
            }
        }

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

        if ($hasBody) {
            $body = $this->parser->subparse([$this, 'decidePartialEnd'], true);
            $stream->expect(TwigToken::BLOCK_END_TYPE);
        }

        $options = [
            'paramNames' => $paramNames,
            'hasOnly' => $hasOnly,
            'hasLazy' => $hasLazy,

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/cms/twig/tokenparser/PartialTokenParser.php:85 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/736ce3a9dc284dbd. Report an issue: GitHub.