octobercms/october · error · Error

The beforeapply callback must return a promise

Error message

The beforeapply callback must return a promise

What it means

Error "The beforeapply callback must return a promise" thrown in octobercms/october.

Source

Thrown at modules/backend/vuecomponents/inspector/assets/js/host-modal.js:99

        onApplyClick: function onApplyClick() {
            if (this.readOnly) {
                return;
            }

            var inspector = this.$refs.inspector,
                that = this;

            that.readOnly = true;

            this.$refs.inspector.validate().then(
                function validateResolve() {
                    var beforeApplyCallbackHolder = {};
                    that.$emit('beforeapply', beforeApplyCallbackHolder);

                    if (beforeApplyCallbackHolder.callback) {
                        var beforeApplyPromise = beforeApplyCallbackHolder.callback(inspector.getCleanObject());
                        if (typeof beforeApplyPromise !== 'object') {
                            throw new Error('The beforeapply callback must return a promise');
                        }

                        if (typeof beforeApplyPromise.then !== 'function') {
                            throw new Error('The beforeapply callback must return a promise');
                        }

                        beforeApplyPromise.then(
                            function beforeApplyPromiseResolve(result) {
                                if (result !== false) {
                                    that.applyAndClose();
                                }
                                that.readOnly = false;
                            },
                            function beforeApplyPromiseReject() {
                                that.readOnly = false;
                            }
                        );
                    }

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/backend/vuecomponents/inspector/assets/js/host-modal.js:99 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/3856ec217b07e291. Report an issue: GitHub.