{"record":{"id":"9fbe10a120b620f8","repo":"getgrav/grav","slug":"switching-flex-user-object-during-onadminsave-even","errorCode":null,"errorMessage":"Switching Flex User object during onAdminSave event is not supported! Please update plugin.","messagePattern":"Switching Flex User object during onAdminSave event is not supported! Please update plugin\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/src/Grav/Common/Flex/Types/Users/UserObject.php","lineNumber":641,"sourceCode":"            $password2 = $this->getProperty('password2');\n            if (!\\is_string($password) || ($password2 && $password !== $password2)) {\n                throw new \\RuntimeException('Passwords did not match.');\n            }\n\n            $this->setProperty('hashed_password', Authentication::create($password));\n        }\n        $this->unsetProperty('password');\n        $this->unsetProperty('password1');\n        $this->unsetProperty('password2');\n\n        // Backwards compatibility with older plugins.\n        $fireEvents = $this->isAdminSite() && $this->getFlexDirectory()->getConfig('object.compat.events', true);\n        $grav = $this->getContainer();\n        if ($fireEvents) {\n            $self = $this;\n            $grav->fireEvent('onAdminSave', new Event(['type' => 'flex', 'directory' => $this->getFlexDirectory(), 'object' => &$self]));\n            if ($self !== $this) {\n                throw new RuntimeException('Switching Flex User object during onAdminSave event is not supported! Please update plugin.');\n            }\n        }\n\n        $instance = parent::save();\n\n        // Backwards compatibility with older plugins.\n        if ($fireEvents) {\n            $grav->fireEvent('onAdminAfterSave', new Event(['type' => 'flex', 'directory' => $this->getFlexDirectory(), 'object' => $this]));\n        }\n\n        return $instance;\n    }\n\n    /**\n     * @return array\n     */\n    public function prepareStorage(): array\n    {","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Flex/Types/Users/UserObject.php#L623-L659","documentation":"Error \"Switching Flex User object during onAdminSave event is not supported! Please update plugin.\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Flex/Types/Users/UserObject.php:641 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":"6040efed04efa69b8209448ed81308e7c24147c2","analyzedAt":"2026-08-17T05:07:31.593Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}