{"record":{"id":"f69894ee67c76d42","repo":"octobercms/october","slug":"error-parsing-the-name-attribute-value-e-f69894","errorCode":null,"errorMessage":"Error parsing the ${name} attribute value. ${e}","messagePattern":"Error parsing the (.+?) attribute value\\. (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"modules/system/assets/js/framework-bundle.js","lineNumber":6061,"sourceCode":"        } else if (typeof dataObj === \"string\") {\n          Object.assign(options.data, paramToObj(\"request-data\", dataObj));\n        }\n      });\n    }\n    function paramToObj(name, value) {\n      if (value === void 0) {\n        value = \"\";\n      }\n      if (typeof value === \"object\") {\n        return value;\n      }\n      if (value.charAt(0) !== \"{\") {\n        value = \"{\" + value + \"}\";\n      }\n      try {\n        return oc.parseJSON(value);\n      } catch (e) {\n        throw new Error(\"Error parsing the \" + name + \" attribute value. \" + e);\n      }\n    }\n  })();\n})();\n","sourceCodeStart":6043,"sourceCodeEnd":6066,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/system/assets/js/framework-bundle.js#L6043-L6066","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"<!-- before -->\n<form data-request=\"onSubmit\" data-request-data=\"{step: 2\">\n\n<!-- after -->\n<form data-request=\"onSubmit\" data-request-data=\"{step: 2}\">","handlingStrategy":"validation","validationCode":"function attributeParses(el, attr) {\n  const raw = el.getAttribute(attr);\n  if (!raw) return true;\n  try {\n    oc.parseJSON(raw.charAt(0) === '{' ? raw : '{' + raw + '}');\n    return true;\n  } catch {\n    return false;\n  }\n}\n\nif (attributeParses(form, 'data-request-data')) oc.request(form, 'onSubmit');","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["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"],"tags":["json","ajax","html-attribute","parser","frontend"],"backgroundTag":"invalid-json-attribute","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}