octobercms/october · error · Error

options must be an object

Error message

options must be an object

What it means

Generic argument-type guard in the Inspector modal host's showModal: the optional options parameter was supplied but is not a JavaScript object (e.g. a string, number, or array was passed). The Inspector options bag is being validated before the modal is created.

Solutions

  1. Pass the options argument as a plain object, e.g. {buttonText: 'Apply'}, or omit it entirely
  2. Verify no caller accidentally spreads or stringifies the options before calling showModal
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at modules/backend/vuecomponents/inspector/assets/js/classes/host.js:25 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

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

        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');
            }

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

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

            if (options.resizableWidth && typeof options.resizableWidth !== 'boolean') {
                throw new Error('options.resizableWidth must be boolean');
            }

View on GitHub (pinned to b608633a7e)