# Error: Invalid string. Length must be a multiple of 4

**URL:** https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201
**Category:** Elasticsearch
**Created:** [December 30, 2021, 11:56am UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201 "2021-12-30T11:56:09Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![mohantychandra](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@mohantychandra](https://discuss.elastic.co/u/mohantychandra)
#### Post date: [December 30, 2021, 11:56am UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/1 "2021-12-30T11:56:09Z")

</div>

Hi Can anyone help to resolve the issue, Any comment is much appreciated. The issue and log is given below.

Invalid string. Length must be a multiple of 4

Error: Invalid string. Length must be a multiple of 4

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [December 30, 2021, 12:12pm UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/2 "2021-12-30T12:12:19Z")

</div>

Not possible with so few details.  
You need to explain what you are exactly doing.

---

<div class="post-metadata">

### Author: ![mohantychandra](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@mohantychandra](https://discuss.elastic.co/u/mohantychandra)
#### Post date: [December 30, 2021, 12:32pm UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/3 "2021-12-30T12:32:05Z")

</div>

I am on discover tab of logstash-\* in Elasticsearch. The search result page does not render and show the below issue

We encountered an error retrieving search results

Search Error

Invalid string. Length must be a multiple of 4

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [December 30, 2021, 12:52pm UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/4 "2021-12-30T12:52:30Z")

</div>

I have no idea. May be a screenshot would help to understand.

---

<div class="post-metadata">

### Author: ![mohantychandra](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@mohantychandra](https://discuss.elastic.co/u/mohantychandra)
#### Post date: [December 30, 2021, 1:05pm UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/5 "2021-12-30T13:05:46Z")

</div>

![Screenshot 2021-12-30 at 13.04.41](https://us1.discourse-cdn.com/elastic/original/3X/8/f/8fd8b36608dbc532abc5bb4448897136352a1e96.png)

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [December 30, 2021, 1:11pm UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/6 "2021-12-30T13:11:48Z")

</div>

Click in _Show error message_ and _See the full error_ and share those messages as a text to help understand what is the issue.

---

<div class="post-metadata">

### Author: ![mohantychandra](https://avatars.discourse-cdn.com/v4/letter/m/6f9a4e/32.png) [@mohantychandra](https://discuss.elastic.co/u/mohantychandra)
#### Post date: [December 30, 2021, 1:21pm UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/7 "2021-12-30T13:21:04Z")

</div>

```auto
Error: Invalid string. Length must be a multiple of 4
    at search_interceptor_SearchInterceptor.handleSearchError (https://XXXXXXXXX:XXXX/bundles/plugin/data/kibana/data.plugin.js:x:xxxxxx)
    at t.selector (https://XXXXXXXXX:XXXX/bundles/plugin/data/kibana/data.plugin.js:x:xxxxxx)
    at t.error (https://XXXXXXXXX:XXXX/XXXXX/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:xxxx:xxxxx)
    at t._error (https://XXXXXXXXX:XXXX/XXXXX/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:xx:xxxx)
    at t.error (https://XXXXXXXXX:XXXX/XXXX/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:xxx:xxxxx)
    at t.error (XXXXXXXXX:XXXX/XXXXX/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:xxx:xxxx)
    at Object.error (XXXXXXXXX:XXXX/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:xxxx:xxxxx)
    at t.__tryOrUnsub (XXXXXXXXX:XXXX/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:xx:xxxx)
    at t.error (XXXXXXXXX:XXXX/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:xx:xxxx)
    at t._error (https://XXXXXXXXX:XXXX/bundles/kbn-ui-shared-deps-npm/kbn-ui-shared-deps-npm.dll.js:xx:xxxx)

```

---

<div class="post-metadata">

### Author: ![rexmccracken](https://avatars.discourse-cdn.com/v4/letter/r/4491bb/32.png) [@rexmccracken](https://discuss.elastic.co/u/rexmccracken)
#### Post date: [December 31, 2021, 7:02pm UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/8 "2021-12-31T19:02:23Z")

</div>

I'm getting the same behavior after upgrading from 7.10.x to 7.16.2. Using the default logstash configuration and the default index pattern configuration.  
The chart usually displays while the documents are background loading and sorting, but then is removed when the error appears. I'm seeing this behavior on:

- Clusters with and without Elasticsearch authentication
- Nodes running all ES roles (dev / testing) and kibana or coordinator-only and kibana

No Elasticsearch errors are showing up in the logs; kibana isn't showing anything specific outside of a known incomplete security configuration on the one erroring cluster. I've even been playing with:

- the amount of memory allocated for node - I _think_ that played a role in allowing some of the queries to return
- timeouts for kibana \<-\> Elasticsearch; seems like failures just took longer (or shorter) based on the timeout settings

Occasionally what I will see on a refresh / reload of the discover dashboard is one of my previous searches showing up without issue, though I believe those are cached as attempting to refresh / update the search ends up with the same behavior. Sometimes the refresh without changing the relative time (15 minutes) will continue to work. Increasing the search window to 20 minutes after refreshing multiple times over a 10 minute period still returns the error.

Partially working configuration:

- 3x 16g RAM hosts
- 3 node ES cluster
- 8G heap to ES running all roles on all nodes
- kibana installed on all 3
- `--max-old-space-size=6144` in `node.options` on test kibana node
- Default configurations (logstash, kibana index patterns) for handling Elasticsearch audit logs

It seems like throwing RAM at the problem does push the issue slightly down the road, but I'm concerned with larger data sets ( currently searching ~400k over a 15 minute period and getting this behavior ) that there will be a severe degradation in what our production users will be able to do.

---

<div class="post-metadata">

### Author: ![morningtho](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/morningtho/32/97848_2.png) [@morningtho](https://discuss.elastic.co/u/morningtho)
#### Post date: [January 6, 2022, 3:40pm UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/9 "2022-01-06T15:40:11Z")

</div>

Unfortunately we had to roll back Kibana to 7.15 to avoid this issue.

Getting the error with a basic configuration (1 ES node / 1 kibana node hosted on the same server). In kibana I've added Elastic sample data. When we try to retrieve more than the last hour, we get the same error:

 ![Capture d’écran 2022-01-06 à 16.36.38](https://us1.discourse-cdn.com/elastic/original/3X/5/4/54b9e8510d1fc71096b62c7787aca8efae9a1035.png)

---

<div class="post-metadata">

### Author: ![dabo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dabo/32/95229_2.png) [@dabo](https://discuss.elastic.co/u/dabo)
#### Post date: [January 7, 2022, 7:39am UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/10 "2022-01-07T07:39:07Z")

</div>

Hi,

We are noticing the same error in Discover with one index pattern (so far). Issue started after upgrading from 7.13.1 to 7.16.2.

We are using Elastic Cloud.

Is anyone from Elastic working on this issue?

Kind regards,  
Dane

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [January 7, 2022, 2:37pm UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/11 "2022-01-07T14:37:07Z")

</div>

If you are using Elastic Cloud I would suggest that you open a support ticket or open a bug report.

Looking at the Kibana [public github](https://github.com/elastic/kibana/issues) I didn't find anything related to this, so probably it wasn't reported as an issue or bug before.

---

<div class="post-metadata">

### Author: ![dabo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dabo/32/95229_2.png) [@dabo](https://discuss.elastic.co/u/dabo)
#### Post date: [January 11, 2022, 3:20pm UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/12 "2022-01-11T15:20:24Z")

</div>

Hi,

I created a ticket [Discover throws an `Invalid string. Length must be a multiple of 4` error · Issue #122664 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/122664)  
and the cause of the error in our case is that there is a document that contains field(s) with extremely long value.

Kind regards,  
Dane

---

<div class="post-metadata">

### Author: ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)
#### Post date: [January 19, 2022, 9:52am UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/13 "2022-01-19T09:52:29Z")

</div>

This is likely a Kibana bug and we are looking at this in [Discover throws an `Invalid string. Length must be a multiple of 4` error · Issue #122664 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/122664)

At the moment we are still struggling with reproduction. If someone would be able to share a document that throws or HAR with the error that would be very helpful 🙏

---

<div class="post-metadata">

### Author: ![dabo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dabo/32/95229_2.png) [@dabo](https://discuss.elastic.co/u/dabo)
#### Post date: [January 19, 2022, 10:56am UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/14 "2022-01-19T10:56:11Z")

</div>

I just shared a sample document.

Kind regards,  
Dane

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 16, 2022, 10:56am UTC](https://discuss.elastic.co/t/error-invalid-string-length-must-be-a-multiple-of-4/293201/15 "2022-02-16T10:56:54Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
