{"record":{"id":"6066b23677ababa6","repo":"octobercms/october","slug":"inspector-object-must-be-an-object","errorCode":null,"errorMessage":"Inspector Object must be an object","messagePattern":"Inspector Object must be an object","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"modules/backend/vuecomponents/inspector/assets/js/classes/host.js","lineNumber":8,"sourceCode":"export class InspectorHost {\n    showModal(title, obj, dataSchema, uniqueId, options, parentObj) {\n        if (typeof title !== 'string' || !title.length) {\n            throw new Error('Inspector title is a required string');\n        }\n\n        if (typeof obj !== 'object') {\n            throw new Error('Inspector Object must be an object');\n        }\n\n        if (parentObj !== undefined && typeof parentObj !== 'object') {\n            throw new Error('Inspector Parent Object must be an object');\n        }\n\n        if (!Array.isArray(dataSchema)) {\n            throw new Error('Inspector data schema must be an array');\n        }\n\n        if (typeof uniqueId !== 'string' || !uniqueId.length) {\n            throw new Error('Inspector unique key is a required string');\n        }\n\n        if (options) {\n            if (typeof options !== 'object') {\n                throw new Error('options must be an object');\n            }","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/vuecomponents/inspector/assets/js/classes/host.js#L1-L26","documentation":"The second showModal() check requires the inspected value itself (`obj`) to be a JavaScript object — the inspector binds its property editors to it. Passing null, a primitive, or a JSON string throws before the modal opens, because there is nothing to bind the schema to.","triggerScenarios":"showModal(title, null, schema, id); passing a JSON.stringify'd object instead of the parsed one; passing a record id or other scalar where the record object was intended; opening the modal before an async fetch resolves (obj still undefined).","commonSituations":"Async data flows where the modal opens on click but the object is still loading; legacy code holding records as serialized strings; argument-order mistakes after adding the options parameter.","solutions":["Pass the plain object being inspected.","JSON.parse serialized payloads before handing them to showModal.","Only open the modal once the object is actually loaded (guard async flows)."],"exampleFix":"// before\nhost.showModal(title, this.fetchedRecord, schema, uniqueId); // may be undefined\n\n// after\nif (!this.fetchedRecord) {\n    return;\n}\nhost.showModal(title, this.fetchedRecord, schema, uniqueId);","handlingStrategy":"validation","validationCode":"const modalObj = typeof obj === 'object' && obj !== null ? obj : null;\nif (!modalObj) {\n    console.error('Inspector modal requires a loaded object');\n    return;\n}\nhost.showModal(title, modalObj, schema, uniqueId);","typeGuard":"function isInspectorObject(value) {\n    return typeof value === 'object' && value !== null;\n}","tryCatchPattern":null,"preventionTips":["Open the modal only after the inspected object has loaded","JSON.parse serialized payloads before passing them"],"tags":["inspector","argument-validation","modal","vue","type-error"],"backgroundTag":"invalid-argument-type","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}