Adding a Kubernetes cluster throws error - Failed to register an agent

I am trying to connect a Kubernetes cluster via Operation >> Kubernetes clusters >> Connect a cluster

Upon entering a name and clicking Regsiter , it throws an error:

• Failed to register an agent
Cannot read properties of null (reading 'project')

Expected Response:

helm commands are generated to be run in the cluster to establish the connectivity between the Kubernetes cluster and Gitlab

Actual Response:

• Failed to register an agent
Cannot read properties of null (reading 'project')

The issue has already been raised and closed as of last year over here: #353073 (closed)

Looks like this issue has resurfaced and I'm unable to connect a Kubernetes cluster due to the following error:

Screenshot 2024-02-25 at 1.42.34 am.png