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

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

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

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

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

Click in Show error message and See the full error and share those messages as a text to help understand what is the issue.

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)

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.

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:


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,

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 I didn't find anything related to this, so probably it wasn't reported as an issue or bug before.


I created a ticket Discover throws an `Invalid string. Length must be a multiple of 4` error · Issue #122664 · elastic/kibana · GitHub
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,

1 Like

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

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 :pray:

I just shared a sample document.

Kind regards,

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