elastic/elasticsearch · critical · IllegalArgumentException
cache capacity must be a value greater than 0 but was {}
Error message
cache capacity must be a value greater than 0 but was {} What it means
Thrown as IllegalArgumentException by the DateProcessor.Cache constructor when the supplied capacity is zero or negative. The constructor is invoked from the static initializer with the parsed int from the system property, so this fires at class-load time if the operator sets es.ingest.date_processor.cache_capacity to 0 or a negative number. Like 1132, it blocks DateProcessor class loading.
Source
Thrown at modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateProcessor.java:248
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) {
return fn;
}
if (map.size() >= capacity) {
map.clear();
}
fn = supplier.get();
map.put(key, new SoftReference<>(fn));
return fn;View on GitHub (pinned to db6a809a66)
Solutions
- Set the property to a positive integer (default 256). To reduce memory pressure pick a small positive value rather than 0.
- Remove the override to use the default.
- If a small cache is genuinely desired, set it to 1 or another small positive number; the cache is backed by a ConcurrentMap with soft references, so it is bounded by capacity.
Example fix
# before (jvm.options) -Des.ingest.date_processor.cache_capacity=0 # after -Des.ingest.date_processor.cache_capacity=256
Defensive patterns
Strategy: validation
Validate before calling
# Pre-flight check the value is strictly positive:
# v=${ES_INGEST_DATE_CACHE:-256}; [ "$v" -gt 0 ] || { echo 'capacity must be > 0'; exit 1; } Prevention
- Set cache_capacity to a positive integer (default 256); never 0.
- If cache pressure is the concern, use a small positive value rather than disabling.
- Validate operator-supplied JVM flags in deployment automation.
When it happens
Trigger: Setting -Des.ingest.date_processor.cache_capacity=0 or any negative integer. The constructor explicitly rejects capacity <= 0.
Common situations: Operators trying to disable the cache by setting it to 0; misconfigured deploy templates that compute a size which underflows to zero; defaulting to 0 in test/staging configs.
Related errors
- {} must be a valid number but was [{}]
- unable to parse date [{}]
- unable to parse date [{}]
- invalid output format [{}]
- Can not start {}, is not a directory: {}
AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12).
Data as JSON: /api/errors/f9f7256747fd04ad.
Report an issue: GitHub.