octobercms/october · error · Error
Invalid update value. The correct format is an object ({...}
Error message
Invalid update value. The correct format is an object ({...}) What it means
Thrown by Options.extractPartials() in October CMS's AJAX framework when the update option passed to a request is not an object. The update map associates partial names with target CSS selectors ({'partialName': '#target'}, plus the special '_self' key); extractPartials iterates its keys to build the X-AJAX-PARTIALS header, so a string, number or other non-object type is rejected before the request is sent.
Source
Thrown at modules/system/assets/js/framework.js:383
}
var xsrfToken = this.getXSRFToken();
if (xsrfToken) {
headers["X-XSRF-TOKEN"] = xsrfToken;
}
var csrfToken = this.getCSRFToken();
if (csrfToken) {
headers["X-CSRF-TOKEN"] = csrfToken;
}
if (options.headers && options.headers.constructor === {}.constructor) {
Object.assign(headers, options.headers);
}
return headers;
}
extractPartials(update = {}, selfPartial) {
var result = [];
if (update) {
if (typeof update !== "object") {
throw new Error("Invalid update value. The correct format is an object ({...})");
}
for (var partial in update) {
if (partial === "_self" && selfPartial) {
result.push(selfPartial);
} else {
result.push(partial);
}
}
}
return result.join("&");
}
getCSRFToken() {
var tag = document.querySelector('meta[name="csrf-token"]');
return tag ? tag.getAttribute("content") : null;
}
getXSRFToken() {
var cookieValue = null;
if (document.cookie && document.cookie != "") {View on GitHub (pinned to b608633a7e)
Solutions
- Convert the value to the partial->selector map: {update: {'search-results': '#result'}}
- If you only want the element's own partial, use the _self key or options.partial instead of a string
- When receiving the map as JSON text, JSON.parse it before passing it into options
Example fix
// before
oc.request(el, 'onSearch', { update: '#result' });
// after
oc.request(el, 'onSearch', { update: { 'search-results': '#result' } }); Defensive patterns
Strategy: type-guard
Validate before calling
const isPlainObject = (v) => Object.prototype.toString.call(v) === '[object Object]';
if (isPlainObject(options.update)) {
oc.request(el, 'onSearch', options);
} else {
console.error('update must map partial names to selectors, e.g. {"results": "#list"}');
} Type guard
const isUpdateMap = (v) => !v || (Object.prototype.toString.call(v) === '[object Object]' && Object.values(v).every((s) => typeof s === 'string'));
Try / catch
try { oc.request(el, 'onSearch', opts); } catch (e) { if (/Invalid update value/.test(e.message)) { console.error('Pass update as {partial: "selector"}'); return; } throw e; } Prevention
- Remember the JS option is an object; only the data-request-update attribute uses string form
- Use '_self' as a key when the element's own partial should refresh
- JSON.parse serialized update maps before passing them as options
When it happens
Trigger: oc.request(el, 'onSearch', {update: '#result'}) - a bare selector string instead of {resultPartial: '#result'}; passing update: 'partialName'; passing a JSON-encoded string instead of a parsed object; update: true from a boolean flag misuse.
Common situations: Developers assuming update takes a selector string like old jQuery plugins; passing a serialized JSON string where the options expect a literal object; copy-pasting from data-request-update attribute syntax (string form) into JS options (object form); forgetting _self must be a key, not a value.
Related errors
- cms::lang.partial.invalid_name
- The request handler name is not specified.
- Invalid handler name. The correct handler name format is: "o
- The property name is not specified.
- The inspectable class name is not specified.
AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21).
Data as JSON: /api/errors/16e84af2194d40d8.
Report an issue: GitHub.