octobercms/october · error · Error

Custom button properties must be an array

Error message

Custom button properties must be an array

What it means

Type guard in handleCustomToolbarButton: after resolving a custom toolbar settings button, its properties field must be an object/array to be used as the settings payload; a malformed button definition (string/null properties) triggers this throw before the settings form opens.

Solutions

  1. Fix the custom button definition so properties is an object/array
  2. Verify the extension's getCustomToolbarSettingsButtons returns well-formed buttons
  3. Validate button config before registering custom toolbar commands
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at modules/cms/assets/js/cms.editor.extension.documentcomponent.base.js:285 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/d21df184cb0ff7f6. Report an issue: GitHub.

Appendix: source

Thrown at modules/cms/assets/js/cms.editor.extension.documentcomponent.base.js:285

                    error.responseText
                );
            }
        },

        handleCustomToolbarButton: function handleCustomToolbarButton(command) {
            const parts = command.split('@');
            const buttonIndex = parts[1];
            const buttons = this.extension.getCustomToolbarSettingsButtons(this.documentType);

            if (!buttons[buttonIndex]) {
                return;
            }

            const button = buttons[buttonIndex];
            const settingsProperties = button.properties;

            if (typeof settingsProperties !== 'object') {
                throw new Error('Custom button properties must be an array');
            }

            let dataHolder = this.documentData;
            if (button.useViewBag) {
                if (!this.viewBagComponent) {
                    throw new Error('View bag component not found');
                }

                dataHolder = JSON.parse(this.viewBagComponent.propertyValues);
            }

            inspectorHost
                .showModal(
                    button.popupTitle ? button.popupTitle : this.documentSettingsPopupTitle,
                    dataHolder,
                    settingsProperties,
                    'cms-custom-settings',
                    {

View on GitHub (pinned to b608633a7e)