octobercms/october · error · Error

options.size must be a string

Error message

options.size must be a string

What it means

Thrown by a guard clause inside showModal when options is provided but options.size is neither null/undefined nor a string. It fires during host-component option validation in the Inspector, meaning the caller passed a malformed size option (e.g. a number or object) for the modal.

Solutions

  1. Pass options.size as a string (e.g. 'large', 'small') or omit it entirely
  2. Coerce numeric sizes to strings before calling showModal
  3. Check the upstream caller that builds the options object and fix the value it assigns to size
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at modules/backend/vuecomponents/inspector/assets/js/classes/host.js:33 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/8eb736d13716497e. Report an issue: GitHub.

Appendix: source

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

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

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

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

View on GitHub (pinned to b608633a7e)