{"record":{"id":"0edde57e2603512e","repo":"octobercms/october","slug":"inspector-parent-object-must-be-an-object","errorCode":null,"errorMessage":"Inspector Parent Object must be an object","messagePattern":"Inspector Parent Object must be an object","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"modules/backend/vuecomponents/inspector/assets/js/classes/host.js","lineNumber":12,"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            }\n\n            if (options.buttonText && typeof options.buttonText !== 'string') {\n                throw new Error('options.buttonText must be a string');\n            }","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/vuecomponents/inspector/assets/js/classes/host.js#L1-L30","documentation":"The optional `parentObj` parameter (used for nested-object inspectors to build correct property paths) is validated only when supplied: anything other than undefined must be a JavaScript object. The parent must be the actual container object, not an identifier — passing an id string or number throws. Quirk: null passes the check because typeof null is 'object'.","triggerScenarios":"showModal(title, obj, schema, id, options, parent.id) — a parent ID string instead of the parent object; passing a serialized parent; argument misalignment when the `options` parameter is omitted but parentObj is passed.","commonSituations":"Tree/nested inspectors where the codebase refers to parents by key; call sites written before the parentObj parameter existed and later given six positional arguments incorrectly.","solutions":["Pass the parent container object itself, or omit the argument / pass undefined when there is no parent.","Never pass parent identifiers (IDs, names) — only the object.","Recheck argument order: (title, obj, dataSchema, uniqueId, options, parentObj)."],"exampleFix":"// before\nhost.showModal(title, obj, schema, uniqueId, options, node.parentId);\n\n// after\nhost.showModal(title, obj, schema, uniqueId, options, node.parent); // the actual parent object","handlingStrategy":"validation","validationCode":"// parentObj is optional; pass undefined or an object, never a scalar\nconst parentArg = (typeof parentObj === 'object' && parentObj !== null) ? parentObj : undefined;\nhost.showModal(title, obj, schema, uniqueId, options, parentArg);","typeGuard":"function isParentObjectArg(value) {\n    return value === undefined || (typeof value === 'object' && value !== null);\n}","tryCatchPattern":null,"preventionTips":["Pass the parent container object, not an id or name","Omit parentObj entirely when there is no parent"],"tags":["inspector","argument-validation","modal","vue","nested-properties"],"backgroundTag":"invalid-argument-type","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}