Insights provisioning logs fail with "KeyNotFoundException" .
Issue Description: Insights Provisioning logs fail with KeyNotFoundException.
The specific error will look like:
System.Collections.Generic.KeyNotFoundException: The given key 'XXXX-XXXX-XXXX-XXX' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at InsightsProvisioning.Jobs.OrchestratorTenantJob.Execute(IJobExecutionContext context) in D:\a\1\s\InsightsInstaller\Insights\Cloud\Provisioning\src\InsightsProvisioning\Jobs\OrchestratorTenantJob.cs:line 81
Root Cause: There are scenarios where the Orchestrator table dbo.tenants has the key and accountId columns in uppercase values. However, in newer versions they will be lowercase. This typically only happens with older versions of Orchestrator.
Diagnosing / Resolving:
- Check the logs under %programdata%/UiPath Insights/Provisioning
- There should be an error about the OrchestratorTenantJob failing.
- Login to the Orchestrator DB using a sql client.
- Check the dbo.Tenants table. (Just do a select top 1000)
- See if the columns 'Key' and 'AccountId' are all capitalized.
- If they are, this is the issue. Making them lowercase will fix the problem.
- If there is a tenant that is lowercase, try just enabling that tenant and see if the error still occurs.
- To fix the issue, change the case of the fields (make sure to backup the DB before hand. Also make a note of the KEYs that are already lowercase).
-
UPDATE [UiPath].[dbo].[Tenants]
set [key] = LOWER([key]), [AccountId] = LOWER([AccountId])
-
- To revert the change, run
-
UPDATE [UiPath].[dbo].[Tenants]
set [key] = UPPER([key]), [AccountId] = UPPER([AccountId])
WHERE [key] NOT IN ('xx-xx-xx-xx', 'xx-xx-xx-xx');
-
- Doing an IIS reset (or just recycling the Provisioning application pool) maybe necessary. The provisioning service tries to provision instance every 10 minutes so if this is not done, just wait 10 minutes at most.
- If the issue is still occuring, raise a ticket with UiPath and include the following
- Screenshot of the dbo.tenants table
- The provisioning logs mentioned above.