It seems there is a Tenant mapped to this project that is causing the issue (it’s failing when it’s building the variables for each environment for the Tenant), could you check the Tenants mapped to the project and see if you can see anything out of the ordinary.
With your tip I was able to resolve the issue. There was a tentacle that was used for a one-off deployment and then it was taken offline. This environment was added to a lifecycle and then to channels and projects.
Despite removing all channels and remapping the hacked-releases into another lifecycle/channel, the environment could still not be deleted. The project mapping for a tenant listed the environment on the main page, but when clicking on the project name and having the connected environment selection pop-up, the environment was not listed–it was on the project list page but was not visible and therefore couldn’t be removed.
Despite deleting the project refrence and re-adding it, the issue remained.
After disconnecting from all projects, and re-adding them back, the issue was resolved.
This was quite a resolution with a lot of clicking and debugging. It would have been ideal to have a better error message when displaying the null reference error, and it would also be much more desirable to perform all required actions when attempting to remove an environment: having to navigate to almost all areas within the application to try and resolve the blocking issues for environment deletion is very slow and painful. The better option would be to remove all the blockers for the user and allow them to continue.
I appreciate your help in resolving this issue–it was certainly odd and one that could not have been resolved without your help.
I agree that we should’ve handled the removal of the environment to prevent this error from happening. I will create an issue for us to get a fix in for this so that it doesn’t happen to other customers.