elastic/elasticsearch · critical · SettingsException

{} must be a valid number but was [{}]

Error message

{} must be a valid number but was [{}]

What it means

Thrown as SettingsException (not IllegalArgumentException) from the DateProcessor.Cache static initializer when the system property 'es.ingest.date_processor.cache_capacity' is set to a non-integer string. Integer.parseInt throws NumberFormatException and the initializer wraps it. Because this runs in a static block, it fails class loading and prevents the date processor (and pipelines using it) from initializing at all.

Source

Thrown at modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateProcessor.java:240

            );
        }
    }

    /**
     * An ad-hoc cache class that just throws away the cached values once it's full because we don't want to affect the performance
     * while applying eviction policies when adding new values or retrieving them.
     */
    static final class Cache {

        private static final String CACHE_CAPACITY_SETTING = "es.ingest.date_processor.cache_capacity";
        static final Cache INSTANCE;

        static {
            var cacheSizeStr = System.getProperty(CACHE_CAPACITY_SETTING, "256");
            try {
                INSTANCE = new Cache(Integer.parseInt(cacheSizeStr));
            } catch (NumberFormatException e) {
                throw new SettingsException("{} must be a valid number but was [{}]", CACHE_CAPACITY_SETTING, cacheSizeStr);
            }
        }
        private final ConcurrentMap<Key, SoftReference<Function<String, ZonedDateTime>>> map;
        private final int capacity;

        Cache(int capacity) {
            if (capacity <= 0) {
                throw new IllegalArgumentException("cache capacity must be a value greater than 0 but was " + capacity);
            }
            this.capacity = capacity;
            this.map = ConcurrentCollections.newConcurrentMapWithAggressiveConcurrency(this.capacity);
        }

        Function<String, ZonedDateTime> getOrCompute(Key key, Supplier<Function<String, ZonedDateTime>> supplier) {
            Function<String, ZonedDateTime> fn;
            var element = map.get(key);
            // element exist and wasn't GCed
            if (element != null && (fn = element.get()) != null) {

View on GitHub (pinned to db6a809a66)

Solutions

  1. Set the property to a plain integer (the default is 256), e.g. -Des.ingest.date_processor.cache_capacity=512 in jvm.options or ES_JAVA_OPTS.
  2. Remove the override entirely to fall back to the default 256.
  3. Audit jvm.options and custom elasticsearch env vars for non-numeric values.

Example fix

# before (jvm.options)
-Des.ingest.date_processor.cache_capacity=512k
# after
-Des.ingest.date_processor.cache_capacity=512
Defensive patterns

Strategy: validation

Validate before calling

# In a pre-flight script before starting ES, validate the property is an integer:
# [[ "${ES_INGEST_DATE_CACHE:-256}" =~ ^-?[0-9]+$ ]] || { echo 'bad cache_capacity'; exit 1; }

Prevention

When it happens

Trigger: Starting the JVM with -Des.ingest.date_processor.cache_capacity=abc (or a non-numeric value via ES_JAVA_OPTS / elasticsearch.yml jvm.options). The static initializer runs when DateProcessor.Cache is first referenced.

Common situations: Operators typing units (e.g. '1024k') thinking it's a size; copy-paste from a docs example with a typo; environment variable drift injecting garbage; CI configs that template the value incorrectly.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/0a239713b7a09311. Report an issue: GitHub.