passbolt/passbolt_api · error · ConflictException

Unexpected error when trying to delete the user.

Error message

Unexpected error when trying to delete the user.

What it means

Catch-all in UserScimResource::delete(): any unexpected Exception thrown during the delete flow (outside the ConflictExceptions) is logged and rethrown as a generic ConflictException 'Unexpected error when trying to delete the user.' (HTTP 409). The original exception message is only available in ScimLog, making this error opaque to the SCIM client.

Solutions

  1. Read ScimLog entries for 'Unable to delete the user with id `...`' — the original exception message and trace are logged there.
  2. Verify database health (connectivity, migrations up to date, no read-only mode) with `ddev refresh` or equivalent, then retry the DELETE.
  3. Retry the request after transient failures; if it persists, report with the logged stack trace.
  4. Exclude the user from the SCIM sync scope until the underlying issue is fixed.
Defensive patterns

Strategy: retry

Try / catch

try {
    $client->delete("/scim/v2.0/Users/{$id}");
} catch (ServerException | ConnectException $e) {
    sleep($backoff); // transient db/infra failure: retry with backoff
    retryDelete($id);
}

Prevention

When it happens

Trigger: DELETE /scim/v2.0/Users/{id} when softDelete() throws rather than returning false: database connection failure, lock timeout, exception raised inside a model event listener, etc.

Common situations: Database outage or migration pending during IdP bulk deprovisioning; a plugin hook throwing during beforeDelete; infrastructure issues (deadlock, read-only replica) during delete.

Related errors


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/347bbcec08a4d7fc. Report an issue: GitHub.

Appendix: source

Thrown at plugins/PassboltEe/Scim/src/Utility/Resource/UserScimResource.php:966

        try {
            $result = $this->Users->softDelete($this->userEntity);
            $errors = $this->userEntity->getErrors();
            if (!$result || $errors !== []) {
                if (isset($errors['id']['soleOwnerOfSharedContent'])) {
                    // @todo: send email
                    throw new ConflictException(
                        'The user cannot be deleted because its the sole owner of shared content'
                    );
                }
                throw new ConflictException('The User resource could not be deleted due to validation failure');
            }
        } catch (Exception $e) {
            ScimLog::error(sprintf('Unable to delete the user with id `%s`', $this->userEntity->id));
            ScimLog::error($e->getMessage());
            ScimLog::error($e->getTraceAsString());

            throw new ConflictException('Unexpected error when trying to delete the user.');
        }

        return $this;
    }

    /**
     * @inheritDoc
     */
    public function toSCIM(): array
    {
        if (!$this->id) {
            throw new ScimException(
                sprintf(
                    'The values of the %s resource has not been set for the `toSCIM` operation',
                    $this->getType()
                )
            );
        }

View on GitHub (pinned to 31c1bbc10f)