octobercms/october · error · Twig\Error\SyntaxError

Cannot use lazy mode with partial tag. Did you mean…

Error message

Cannot use lazy mode with partial tag. Did you mean ajaxPartial?

What it means

Twig parse-time error from the partial token parser: the 'lazy' option is only supported by the ajaxPartial tag, not the plain partial tag. The offending input is a lazy= parameter on a {% partial %} tag.

Solutions

  1. Replace {% partial name lazy=true %} with {% ajaxPartial name lazy=true %}
  2. Remove the lazy option if AJAX loading is not needed
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

        $paramNames = [];
        $hasBody = $hasOnly = $hasLazy = false;
        $body = null;

        $isAjax = $this->getTag() === 'ajaxPartial';

        // Parse partial name (first argument)
        $nodes['__partial_name'] = $this->parser->parseExpression();

        // Parse optional parameters
        while (!$stream->test(TwigToken::BLOCK_END_TYPE)) {
            $current = $stream->next();

            $isKeywordCandidate = !$stream->test(TwigToken::OPERATOR_TYPE, '=')
                && !$stream->test(TwigToken::OPERATOR_TYPE, '-');

            if ($current->test(TwigToken::NAME_TYPE, 'lazy') && $isKeywordCandidate) {
                if (!$isAjax) {
                    throw new TwigErrorSyntax(
                        'Cannot use lazy mode with partial tag. Did you mean ajaxPartial?',
                        $stream->getCurrent()->getLine(),
                        $stream->getSourceContext()
                    );
                }
                $hasLazy = true;
                continue;
            }

            if ($current->test(TwigToken::NAME_TYPE, 'body') && $isKeywordCandidate) {
                $hasBody = true;
                continue;
            }

            if ($current->test(TwigToken::NAME_TYPE, 'only') && $isKeywordCandidate) {
                $hasOnly = true;
                continue;
            }

View on GitHub (pinned to b608633a7e)