octobercms/october · error · Error
Error parsing the ${name} attribute value. ${e}
Error message
Error parsing the ${name} attribute value. ${e} What it means
October CMS's `{% partial %}` Twig tag renders immediately, while the `lazy` keyword (deferred, AJAX-loaded content) belongs only to the `{% ajaxPartial %}` tag. In PartialTokenParser::parse, `$isAjax` is true only when getTag() returns 'ajaxPartial'; a `lazy` NAME token inside a plain `{% partial %}` is therefore rejected at compile time with this SyntaxError. The message deliberately points you at ajaxPartial because that is the tag that supports lazy mode.
Source
Thrown at modules/backend/assets/foundation/controls/autocomplete/autocomplete.js:384
$.fn.autocomplete.noConflict = function () {
$.fn.autocomplete = old
return this
}
/* AUTOCOMPLETE DATA-API
* ================== */
function paramToObj(name, value) {
if (value === undefined) value = ''
if (typeof value == 'object') return value
try {
return oc.parseJSON("{" + value + "}")
}
catch (e) {
throw new Error('Error parsing the '+name+' attribute value. '+e)
}
}
$(document).on('focus.autocomplete.data-api', '[data-control="autocomplete"]', function (e) {
var $this = $(this)
if ($this.data('autocomplete')) return
var opts = $this.data()
if (opts.source) {
opts.source = paramToObj('data-source', opts.source)
}
$this.autocomplete(opts)
})
}(window.jQuery);
View on GitHub (pinned to b608633a7e)
Solutions
- Change the tag from `{% partial "name" lazy %}` to `{% ajaxPartial "name" lazy %}` — lazy mode is only supported there.
- If you do not want AJAX/deferred loading, simply remove the `lazy` keyword from the `{% partial %}` tag.
- If you meant a parameter literally named lazy, write it as a pair: `{% partial "name" lazy=true %}` (this parses as an expression and is not treated as the keyword).
Example fix
// before
{% partial "cards" lazy %}
// after
{% ajaxPartial "cards" lazy %} Defensive patterns
Strategy: validation
Validate before calling
// Lint templates before deploy: flag `lazy` used inside a plain {% partial %} tag
$contents = file_get_contents($templatePath);
if (preg_match('/{%-?\s*partial\b[^%]*?\blazy\b(?!\s*=)/', $contents)) {
throw new RuntimeException("{$templatePath}: `lazy` requires the {% ajaxPartial %} tag");
} Try / catch
// Parsing happens at compile time; surface it cleanly instead of a 500
templateSyntax: try {
$twig->load($templateName);
} catch (Twig\Error\SyntaxError $e) {
// $e->getMessage() includes the file and line, e.g. the ajaxPartial hint
Log::warning('Template syntax: '.$e->getMessage());
} Prevention
- Use {% ajaxPartial %} whenever a partial needs lazy or deferred loading.
- Run a template lint/compile step in CI so tag misuse fails the build, not the page.
- Write lazy parameters as key=value if the word lazy is genuinely a parameter name.
When it happens
Trigger: Writing `{% partial "cards" lazy %}` in any CMS page, layout or partial template. Any template that contains the word `lazy` as a bare keyword (not `lazy=...` and not part of a hyphenated name) inside a `{% partial %}` tag fails the moment Twig parses the template.
Common situations: Copying a lazy-loading example from the ajaxPartial docs but keeping the `partial` tag name; upgrading a project where templates previously used `ajaxPartial`-style syntax on the wrong tag; following tutorials that mix the two tags.
Related errors
- Error parsing the data-chart-options attribute value. ${e}
- Error parsing Inspector field values. ${err}
- Error parsing Inspector configuration. ${err}
- ${errorMessage} Property: ${this.propertyDefinition.property
- The titleProperty property should be specified in the object
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/d0b08a79cf9700f5.
Report an issue: GitHub.