{"record":{"id":"3856ec217b07e291","repo":"octobercms/october","slug":"the-beforeapply-callback-must-return-a-promise","errorCode":null,"errorMessage":"The beforeapply callback must return a promise","messagePattern":"The beforeapply callback must return a promise","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"modules/backend/vuecomponents/inspector/assets/js/host-modal.js","lineNumber":99,"sourceCode":"        onApplyClick: function onApplyClick() {\n            if (this.readOnly) {\n                return;\n            }\n\n            var inspector = this.$refs.inspector,\n                that = this;\n\n            that.readOnly = true;\n\n            this.$refs.inspector.validate().then(\n                function validateResolve() {\n                    var beforeApplyCallbackHolder = {};\n                    that.$emit('beforeapply', beforeApplyCallbackHolder);\n\n                    if (beforeApplyCallbackHolder.callback) {\n                        var beforeApplyPromise = beforeApplyCallbackHolder.callback(inspector.getCleanObject());\n                        if (typeof beforeApplyPromise !== 'object') {\n                            throw new Error('The beforeapply callback must return a promise');\n                        }\n\n                        if (typeof beforeApplyPromise.then !== 'function') {\n                            throw new Error('The beforeapply callback must return a promise');\n                        }\n\n                        beforeApplyPromise.then(\n                            function beforeApplyPromiseResolve(result) {\n                                if (result !== false) {\n                                    that.applyAndClose();\n                                }\n                                that.readOnly = false;\n                            },\n                            function beforeApplyPromiseReject() {\n                                that.readOnly = false;\n                            }\n                        );\n                    }","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/vuecomponents/inspector/assets/js/host-modal.js#L81-L117","documentation":"Error \"The beforeapply callback must return a promise\" thrown in octobercms/october.","triggerScenarios":"Thrown at modules/backend/vuecomponents/inspector/assets/js/host-modal.js:99 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}