octobercms/october · error · Error

Inspector Parent Object must be an object

Error message

Inspector Parent Object must be an object

What it means

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'.

Source

Thrown at modules/backend/vuecomponents/inspector/assets/js/classes/host.js:12

export class InspectorHost {
    showModal(title, obj, dataSchema, uniqueId, options, parentObj) {
        if (typeof title !== 'string' || !title.length) {
            throw new Error('Inspector title is a required string');
        }

        if (typeof obj !== 'object') {
            throw new Error('Inspector Object must be an object');
        }

        if (parentObj !== undefined && typeof parentObj !== 'object') {
            throw new Error('Inspector Parent Object must be an object');
        }

        if (!Array.isArray(dataSchema)) {
            throw new Error('Inspector data schema must be an array');
        }

        if (typeof uniqueId !== 'string' || !uniqueId.length) {
            throw new Error('Inspector unique key is a required string');
        }

        if (options) {
            if (typeof options !== 'object') {
                throw new Error('options must be an object');
            }

            if (options.buttonText && typeof options.buttonText !== 'string') {
                throw new Error('options.buttonText must be a string');
            }

View on GitHub (pinned to b608633a7e)

Solutions

  1. Pass the parent container object itself, or omit the argument / pass undefined when there is no parent.
  2. Never pass parent identifiers (IDs, names) — only the object.
  3. Recheck argument order: (title, obj, dataSchema, uniqueId, options, parentObj).

Example fix

// before
host.showModal(title, obj, schema, uniqueId, options, node.parentId);

// after
host.showModal(title, obj, schema, uniqueId, options, node.parent); // the actual parent object
Defensive patterns

Strategy: validation

Validate before calling

// parentObj is optional; pass undefined or an object, never a scalar
const parentArg = (typeof parentObj === 'object' && parentObj !== null) ? parentObj : undefined;
host.showModal(title, obj, schema, uniqueId, options, parentArg);

Type guard

function isParentObjectArg(value) {
    return value === undefined || (typeof value === 'object' && value !== null);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid argument type errors: "must be of type string", "expected X, got Y", and ERR_INVALID_ARG_TYPE explained — this error's family across 15 libraries.

Related errors


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/0edde57e2603512e. Report an issue: GitHub.