Setting must be non-negative SHARED CACHE SETTINGS PREFIX size – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.12-8.9

Briefly, this error occurs when the size setting for the shared cache in Elasticsearch is set to a negative value. Elasticsearch requires this value to be non-negative for proper functioning. To resolve this issue, you can adjust the shared cache size setting in your Elasticsearch configuration file (elasticsearch.yml) to a non-negative value. Alternatively, you can use the Elasticsearch API to update this setting dynamically, again ensuring the value is non-negative.

This guide will help you check for common problems that cause the log ” setting [{}] must be non-negative”; SHARED_CACHE_SETTINGS_PREFIX + “size ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.

Log Context

Log “setting [{}] must be non-negative”; SHARED_CACHE_SETTINGS_PREFIX + “size” class name is We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 }  @Override
 public void validate(final RelativeByteSizeValue value; final Map; Object> settings) {
 if (value.isAbsolute() && value.getAbsolute().getBytes() == -1) {
 throw new SettingsException("setting [{}] must be non-negative"; SHARED_CACHE_SETTINGS_PREFIX + "size");
 if (value.isNonZeroSize()) {
 final List roles = (List) settings.get(NodeRoleSettings.NODE_ROLES_SETTING);
 final var rolesSet = Set.copyOf(roles);