octobercms/october · error · Error
Error parsing the ${name} attribute value. ${e}
Error message
Error parsing the ${name} attribute value. ${e} What it means
Thrown by JsonParser.paramToObj(name, value) in the October CMS framework bundle when a data-* attribute configured for lenient JSON parsing (data-request-data, data-request-update, data-request-query, etc.) fails to parse. The value is wrapped in braces if needed, run through oc.parseJSON, and any inner parser error is rethrown prefixed with the attribute name, so the message tells you both which attribute is broken and why.
Source
Thrown at modules/system/assets/js/framework-bundle.js:6061
} else if (typeof dataObj === "string") {
Object.assign(options.data, paramToObj("request-data", dataObj));
}
});
}
function paramToObj(name, value) {
if (value === void 0) {
value = "";
}
if (typeof value === "object") {
return value;
}
if (value.charAt(0) !== "{") {
value = "{" + value + "}";
}
try {
return oc.parseJSON(value);
} catch (e) {
throw new Error("Error parsing the " + name + " attribute value. " + e);
}
}
})();
})();
View on GitHub (pinned to b608633a7e)
Solutions
- Read the attribute name and the chained inner message in the error - fix that exact spot in the markup (quote the word, close the bracket, spell true/false/null)
- Test the value in the console: oc.parseJSON(el.getAttribute('data-request-data')) until it parses clean
- Emit these attributes with JSON.stringify/json_encode from code instead of hand-writing them
- After fixing, re-trigger the request to confirm the element still carries a valid data-request handler
Example fix
<!-- before -->
<form data-request="onSubmit" data-request-data="{step: 2">
<!-- after -->
<form data-request="onSubmit" data-request-data="{step: 2}"> Defensive patterns
Strategy: validation
Validate before calling
function attributeParses(el, attr) {
const raw = el.getAttribute(attr);
if (!raw) return true;
try {
oc.parseJSON(raw.charAt(0) === '{' ? raw : '{' + raw + '}');
return true;
} catch {
return false;
}
}
if (attributeParses(form, 'data-request-data')) oc.request(form, 'onSubmit'); Try / catch
try { oc.request(el, 'onSubmit'); } catch (e) { if (/Error parsing the .* attribute value/.test(e.message)) { console.error('Fix data attribute:', e.message); return; } throw e; } Prevention
- Pre-validate data-request-data/update/query with oc.parseJSON before wiring requests
- Emit those attributes via JSON.stringify/json_encode
- Include the element's outerHTML in error logs to pinpoint the broken markup
When it happens
Trigger: Triggering oc.request() on an element whose data-request-data="{a: tru}" or data-request-update="{'partial': '#id'" contains invalid relaxed JSON; the inner error (Broken JSON ... near ...) is chained into this message. Also thrown when data-request-query holds a malformed object literal.
Common situations: Hand-edited data attributes with typos, truncation, unbalanced brackets or unquoted keywords; CMS authors editing partial markup; values injected by templates with entity-escaped quotes; migrating old markup whose quoting style the new parser rejects.
Related errors
- Broken JSON boolean body near ${str}
- Error parsing the ${name} attribute value. ${e}
- Broken JSON number body near ${body}
- Broken JSON ${str[pos] === "{" ? "object" : "array"} body ne
- Broken JSON body near ${str}
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/f69894ee67c76d42.
Report an issue: GitHub.