Problem
When connecting to a GitLab repository via the GitLab plugin in a JetBrains IDE, the connection fails with the error:
Could not connect to repository <url> with account <account-url>.
Cannot invoke "kotlin.jvm.functions.Function1.invoke(Object)" because the return value of "java.net.http.HttpResponse.Body()" is null
Clicking Log in again and entering a freshly generated token (with api and read_user scopes) results in:
Login failed. Check API token or GitLab version. Log in via Git if the version is older than 14.0.
Clicking Log in via Git closes the dialog without completing the connection.
This typically affects self-hosted GitLab servers (e.g., GitLab Enterprise Edition) reachable only through a VPN or on a private network.
Cause
The IDE's HTTP proxy bypass list (No proxy for field) is matched against the request hostname, not against the resolved IP address. When a private GitLab server's IP range (for example 10.0.0.0/8) is listed in the bypass list but the GitLab hostname does not match a corresponding entry, the request is routed through the corporate HTTP proxy. The proxy returns an empty response body for the GitLab API call, which the GitLab plugin cannot parse — surfacing as the HttpResponse.Body() is null error.
The same API request usually succeeds when issued directly with curl from the same machine, because curl does not honor the IDE's proxy configuration.
Resolution
-
Open File | Settings | Appearance & Behavior | System Settings | HTTP Proxy.
-
In the No proxy for field, add the GitLab server hostname using a wildcard prefix so that subdomains are matched as well. For example, replace:
internal.example.comwith:
*.internal.example.com -
Click Apply.
-
Retry the GitLab connection from File | Settings | Version Control | GitLab.
Verification
If the connection still fails, confirm that the GitLab API is reachable outside the IDE by running the GraphQL metadata query with curl:
curl -X POST https://<gitlab-host>/api/graphql/ \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{"query": "query { metadata { version revision enterprise } }"}'
A successful response confirms that the token, network route, and GitLab version are valid. If curl succeeds but the IDE still fails, the proxy or VPN-aware network security software is intercepting the IDE's connections — verify the IDE proxy configuration once more, or test on a different network (e.g., a phone hotspot) to isolate the cause.
Additional information
- Related YouTrack issue (improvement to error reporting in this scenario): IJPL-243432
- Documentation: Configure HTTP proxy
Comments
0 comments
Please sign in to leave a comment.