{"record":{"id":"b249330dc0163594","repo":"yiisoft/yii2","slug":"request-must-be-xmlhttprequest","errorCode":null,"errorMessage":"Request must be XMLHttpRequest.","messagePattern":"Request must be XMLHttpRequest\\.","errorType":"http","errorClass":"BadRequestHttpException","httpStatus":400,"severity":"error","filePath":"framework/filters/AjaxFilter.php","lineNumber":69,"sourceCode":"     * {@inheritdoc}\n     */\n    public function init()\n    {\n        if ($this->request === null) {\n            $this->request = Yii::$app->getRequest();\n        }\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function beforeAction($action)\n    {\n        if ($this->request->getIsAjax()) {\n            return true;\n        }\n\n        throw new BadRequestHttpException($this->errorMessage);\n    }\n}\n","sourceCodeStart":51,"sourceCodeEnd":72,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/filters/AjaxFilter.php#L51-L72","documentation":"Error \"Request must be XMLHttpRequest.\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/filters/AjaxFilter.php:69 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":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}