octobercms/october · error · Error

options.buttonText must be a string

Error message

options.buttonText must be a string

What it means

Type guard in ModalUtils' shared options validation (used by showAlert/showConfirm): options.buttonText is present but is not a string. The button label must be text; any other type is rejected before the alert/confirm dialog renders.

Solutions

  1. Provide buttonText as a string or leave it undefined for the default label
  2. Convert non-string labels (e.g. numbers) to strings before passing options
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at modules/backend/vuecomponents/modal/assets/js/classes/utils.js:12 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/5aa6f9efdae8b40a. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/vuecomponents/modal/assets/js/classes/utils.js:12

/*
 * Modal utilities helper
 */
export class ModalUtils {
    #validateAlertOptions(options) {
        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');
            }
        }

        return options || {};
    }

    #validateBasicArguments(title, text) {
        if (typeof title !== 'string' || !title.length) {
            throw new Error('Modal title is required');
        }

        if (typeof text !== 'string' || !text.length) {
            throw new Error('Modal text is required');
        }

View on GitHub (pinned to b608633a7e)