Tenant variables page showing Value cannot be null. Parameter name: key error

The tenants variables page is showing an System.ArgumentNullException: Value cannot be null. Parameter name: key as shown in the screenshot.

We are using Octopus 3.4.8
We have 2 Tenants having both around 30 projects assigned to them.
Only 1 of the tenants is throwing these errors on the variable pages.
Things we tried to fix it:

  • Checked the changelog for issues containing the word “variable” which could have fixed our issue.
    3.4.8 is 1 year old. We are not planning on upgrading right now, unless we are sure this will fix the issue.
  • Searched support forums and found 2 people having the same problem, which didn’t provide a clear solution for us.
    Value cannot be null. Parameter name: key | Octopus v3.4.11
    Tenant variables showing error page
  • Checked the Octopus log files at C:\octopus\logfiles, which only gave the same stacktrace as shown in the browser.
  • Compared the projects in the 2 tenants and tried removing and adding some of the projects.
  • Restarted the Octopus machine multiple times

Any idea on how to solve this issue ?

Hi Arjan

I am sorry to hear that you are having this problem, we suspect that this issue could be caused by a null value in the database.

Could you try to send a request with this URL template https://{your-server}/api/tenants/{your-tenant-id} to check the Json response, the Json document should have a property named ProjectEnvironments and there might be a null value in the array of the project similar to the following
"ProjectEnvironments": { "Your project Id": [ null, "Environment-1", "Environment-2" ] }

If that is the case, you can fix this problem by doing a manual database update to the Tenant table remove the null value, it should look something like that after the update
"ProjectEnvironments": { "Your project Id": [ "Environment-1", "Environment-2" ] }

or you can disconnect the tenant from the project and add it back on again, please note that this option require to setup all the tenant variables again if there is any.

Hope that helps

Regards
Eddy

Thnx Eddy, that helped!

Calling the api directly did throw the same error.

The json object in the Tenants table had 1 NULL value in 1 of the projects entries in this object.
We could lookup the name for this project in the projects tables.

Re-adding this project to the tenant in the octopus site solved the issue.