{"record":{"id":"2c9fd5fef5a306cb","repo":"octobercms/october","slug":"error-parsing-inspector-field-values-err","errorCode":null,"errorMessage":"Error parsing Inspector field values. ${err}","messagePattern":"Error parsing Inspector field values\\. (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"modules/backend/assets/foundation/controls/inspector/inspector.datainteraction.js","lineNumber":58,"sourceCode":"            if (propertyInfo.property.toLowerCase() == lowerCaseCode) {\n                return propertyInfo.property\n            }\n        }\n\n        return code\n    }\n\n    DataInteraction.prototype.loadValues = function(configuration) {\n        var valuesField = this.getElementValuesInput()\n\n        if (valuesField) {\n            var valuesStr = $.trim(valuesField.value)\n\n            try {\n                return valuesStr.length === 0 ? {} : JSON.parse(valuesStr)\n            }\n            catch (err) {\n                throw new Error('Error parsing Inspector field values. ' + err)\n            }\n        }\n\n        var values = {},\n            attributes = this.element.attributes\n\n        for (var i=0, len = attributes.length; i < len; i++) {\n            var attribute = attributes[i],\n                matches = []\n\n            if (matches = attribute.name.match(/^data-property-(.*)$/)) {\n                // Important - values contained in data-property-xxx attributes are\n                // considered strings and never parsed with JSON. The use of the\n                // data-property-xxx attributes is very limited - they're only\n                // used in Pages for creating snippets from partials, where properties\n                // are created with a table UI widget, which doesn't allow creating\n                // properties of any complex types.\n                //","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/assets/foundation/controls/inspector/inspector.datainteraction.js#L40-L76","documentation":"The October CMS `{% put %}` tag has two modes: direct assignment (`{% put a, b = expr1, expr2 %}`) and block capture. In direct-assignment mode, PutTokenParser counts the target names from parseAssignmentExpression and the values from parseMultitargetExpression and throws this SyntaxError when the counts differ — assignment is all-or-nothing per side.","triggerScenarios":"Writing `{% put a, b = 1, 2, 3 %}` (3 values for 2 names) or `{% put a = 1, 2 %}` (2 values for 1 name). It fires during Twig parsing, before any evaluation.","commonSituations":"Adding another variable to one side of an existing `{% put %}` line and forgetting the other; refactoring placeholder assignments; copying set-style syntax where counts can differ.","solutions":["Make the number of values match the number of names exactly, e.g. `{% put a, b = 1, 2 %}`.","If you only need one of the values, use separate `{% put a = 1 %}` statements.","For computed/multiple outputs, use a single array value: `{% put pair = [1, 2] %}`."],"exampleFix":"// before\n{% put listItems, total = 1, 2, 3 %}\n\n// after\n{% put listItems, total = [1, 2, 3], 3 %}","handlingStrategy":"try-catch","validationCode":"// Author-time check: counts on both sides of `=` must match\n$src = '{% put a, b = 1, 2, 3 %}';\nif (preg_match('/{%-?\\s*put\\s+([^=]+?)\\s*=\\s*([^%]+?)\\s*%-?}/', $src, $m)) {\n    $names = preg_split('/\\s*,\\s*/', trim($m[1]));\n    $values = preg_split('/\\s*,\\s*/', trim($m[2]));\n    if (count($names) !== count($values)) {\n        throw new RuntimeException('put targets and values count mismatch');\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    $twig->load($template);\n} catch (Twig\\Error\\SyntaxError $e) {\n    if (str_contains($e->getMessage(), 'same number of variables')) {\n        // fix the {% put %} line named in the error\n    }\n    throw $e;\n}","preventionTips":["Keep one name and one value per {% put %} unless pairing lists deliberately.","Re-count both sides whenever you add a variable to a put tag.","Prefer separate put statements or an array value for grouped data."],"tags":["twig","october-cms","put","template-syntax","compile-time"],"backgroundTag":"twig-syntax-error","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}