# Error: org.apache.http.ProtocolException: Not a valid protocol version: 0

**URL:** <https://discuss.elastic.co/t/error-org-apache-http-protocolexception-not-a-valid-protocol-version-0/368212>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [October 3, 2024, 5:29pm UTC](https://discuss.elastic.co/t/error-org-apache-http-protocolexception-not-a-valid-protocol-version-0/368212 "2024-10-03T17:29:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaykadambi](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@jaykadambi](https://discuss.elastic.co/u/jaykadambi)\
**Post date:** [October 3, 2024, 5:29pm UTC](https://discuss.elastic.co/t/error-org-apache-http-protocolexception-not-a-valid-protocol-version-0/368212/1 "2024-10-03T17:29:28Z")

</div>

- We recently upgraded our development environment from Elasticsearch cluster version **8.6.2 to 8.15.1**

- We are using the High Level Rest Client with **apiCompatibilityMode=true**

- After the upgrade, we started seeing sporadic 500 errors from Elastic queries. We had not seen these prior to the upgrade and we had apiCompatibilityMode set to true earlier as well.

- When this happens we can see following exceptions in the logs:

- Digging through the TRACE level logs of the Elasticsearch client and Apache have yielded no results and it's still unclear why this issue is sporadically happening

- We have been unable to replicate the issue through curl or kibana

- We have tried a few configuration changes in the Http Client, but have not been able to stabilize our Dev environment so far

Please advise if anyone has ran into this problem and any suggestions to help resolve it.

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [October 3, 2024, 5:34pm UTC](https://discuss.elastic.co/t/error-org-apache-http-protocolexception-not-a-valid-protocol-version-0/368212/2 "2024-10-03T17:34:16Z")

</div>

`org.apache.http.ProtocolException: Not a valid protocol version` means that the server is not sending a proper http response.

A common cause is that the client is configured to use http while the server expects https, or the other way around.

Can you check the configuration of your application and make sure it uses the correct protocol ?

---

<div class="post-metadata">

**Author:** ![jaykadambi](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@jaykadambi](https://discuss.elastic.co/u/jaykadambi)\
**Post date:** [October 3, 2024, 6:16pm UTC](https://discuss.elastic.co/t/error-org-apache-http-protocolexception-not-a-valid-protocol-version-0/368212/3 "2024-10-03T18:16:50Z")

</div>

Thanks for your quick response. Yes, our application makes SSL connections and our server endpoint is https.

One additional point to share, which we found interesting is, when we set _ConnectionReuseStrategy_ on the _RestClientBuilder_ (using setHttpClientConfigCallback) to **NoConnectionReuseStrategy** , the protocolException does **not** appear anymore. However, we do not want to go with this solution as it would not reuse connections.

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [October 4, 2024, 11:42am UTC](https://discuss.elastic.co/t/error-org-apache-http-protocolexception-not-a-valid-protocol-version-0/368212/4 "2024-10-04T11:42:26Z")

</div>

Since I understand you're using the same HLRC version, this certainly comes from a change in the environment (including the cluster upgrade) and not the client library. The fact that the problem disappears with `NoConnectionReuseStrategy` seems to confirm that.

The 500 errors are also unrelated to the client and indicate an issue on the Elasticsearch server side, which you should see in the server logs.

Or are there some proxy/gateway/load-balancer between the application and the server that could cause the issue?

---

<div class="post-metadata">

**Author:** ![jaykadambi](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@jaykadambi](https://discuss.elastic.co/u/jaykadambi)\
**Post date:** [October 7, 2024, 3:56pm UTC](https://discuss.elastic.co/t/error-org-apache-http-protocolexception-not-a-valid-protocol-version-0/368212/5 "2024-10-07T15:56:32Z")

</div>

> [@swallez](#):
>
> s

Thanks! Yes, our cluster is behind a load balancer.

---

<div class="post-metadata">

**Author:** ![swallez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/swallez/32/11972_2.png) [@swallez](https://discuss.elastic.co/u/swallez)\
**Post date:** [October 7, 2024, 4:54pm UTC](https://discuss.elastic.co/t/error-org-apache-http-protocolexception-not-a-valid-protocol-version-0/368212/6 "2024-10-07T16:54:39Z")

</div>

> [@jaykadambi](#):
>
> Thanks! Yes, our cluster is behind a load balancer.

So you should definitely investigate in this area.
