diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index f8bb84d58bbbf..d3974cae8914a 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -454,7 +454,16 @@ public function createUserFromBackend($uid, $password, UserInterface $backend): if ($state === false) { throw new \InvalidArgumentException($l->t('Could not create account')); } - $user = $this->getUserObject($uid, $backend); + try { + $user = $this->getUserObject($uid, $backend); + } catch (\RuntimeException $e) { + $this->logger->error('Failed to get user after creation', [ + 'exception' => $e, + 'uid' => $uid, + 'exists_backend' => $backend->userExists($uid), + ]); + throw new \RuntimeException('Failed to get user after creation', previous: $e); + } if ($user instanceof IUser) { /** @deprecated 21.0.0 use UserCreatedEvent event with the IEventDispatcher instead */ $this->emit('\OC\User', 'postCreateUser', [$user, $password]);