Insights Installer Throws: UiPath IdentityServer Web Middleware ExceptionHandlingMiddleware Client With ClientId Already Exists

Why Insights installation generates an error when finishing about an entry that already exists?

Issue Description: This error occurs when a UiPath service is trying to register itself to the identity service, but the registration already exists. This could occur in the following scenarios:

  1. The application is already installed (for example if Insights was installed but then someone else has tried to install another instance of Insights and pointed it to the same Orchestrator instance)
  2. It could occur after a failed install where items were not properly cleaned up
  3. It could be a bug (should be fixed in the latest 22.10 version).
UiPath.IdentityServer.Web.Middleware.ExceptionHandlingMiddleware Client with ClientId "814f8826-d34d-441c-b8a9-b66d32c3a18e" already exists
ArgumentException*Client with ClientId "814f8826-d34d-441c-b8a9-b66d32c3a18e" already exists*   at UiPath.IdentityServer.Application.Services.ClientService.CreateAsync(Client client)
   at UiPath.IdentityServer.Web.Controllers.API.ClientController.CreateClientAsync(CreateClientCommand createClientCommand)



Diagnosing / Resolving:

  1. Ensure that the product is not already installed or that the right parameters are being used (i.e. maybe the installer was pointed to UAT instead of production)
  2. Check the identity DB under identity.clients table (usually this is part of the Orchestrator DB). Look for the mentioned clientId
    • If it exists take a screenshot
  3. If the clientId does not exist, then most likely this is an HAA setup and Redis is being used.
    1. Perform a Redis flush and check if it helps. Follow the below steps,
      1. Login to the Redis machine
      2. Run the following command: redis-cli -h host -p port -a password
      3. Run Flushall command in the HAA node
    2. It is possible to disable one of the Orchestrator nodes and disable the redis cache for identity
      1. Set RedisClientCache to False on the C:\Program Files (x86)\UiPath\Orchestrator\Identity\appsettings.Production.json
      2. This needs to be reverted post install.
  4. If the clientId exists, and the software is not already installed, open a ticket with UiPath.
    1. Most likely it may be required to delete the clientId but it would be better for UiPath to investigate first
    2. In the ticket include screenshot of the id in the DB and relevant error messages.