{"record":{"id":"0a239713b7a09311","repo":"elastic/elasticsearch","slug":"must-be-a-valid-number-but-was","errorCode":null,"errorMessage":"{} must be a valid number but was [{}]","messagePattern":"(.+?) must be a valid number but was \\[(.+?)\\]","errorType":"exception","errorClass":"SettingsException","httpStatus":null,"severity":"critical","filePath":"modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateProcessor.java","lineNumber":240,"sourceCode":"            );\n        }\n    }\n\n    /**\n     * 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\n     * while applying eviction policies when adding new values or retrieving them.\n     */\n    static final class Cache {\n\n        private static final String CACHE_CAPACITY_SETTING = \"es.ingest.date_processor.cache_capacity\";\n        static final Cache INSTANCE;\n\n        static {\n            var cacheSizeStr = System.getProperty(CACHE_CAPACITY_SETTING, \"256\");\n            try {\n                INSTANCE = new Cache(Integer.parseInt(cacheSizeStr));\n            } catch (NumberFormatException e) {\n                throw new SettingsException(\"{} must be a valid number but was [{}]\", CACHE_CAPACITY_SETTING, cacheSizeStr);\n            }\n        }\n        private final ConcurrentMap<Key, SoftReference<Function<String, ZonedDateTime>>> map;\n        private final int capacity;\n\n        Cache(int capacity) {\n            if (capacity <= 0) {\n                throw new IllegalArgumentException(\"cache capacity must be a value greater than 0 but was \" + capacity);\n            }\n            this.capacity = capacity;\n            this.map = ConcurrentCollections.newConcurrentMapWithAggressiveConcurrency(this.capacity);\n        }\n\n        Function<String, ZonedDateTime> getOrCompute(Key key, Supplier<Function<String, ZonedDateTime>> supplier) {\n            Function<String, ZonedDateTime> fn;\n            var element = map.get(key);\n            // element exist and wasn't GCed\n            if (element != null && (fn = element.get()) != null) {","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateProcessor.java#L222-L258","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Remove the override entirely to fall back to the default 256.","Audit jvm.options and custom elasticsearch env vars for non-numeric values."],"exampleFix":"# before (jvm.options)\n-Des.ingest.date_processor.cache_capacity=512k\n# after\n-Des.ingest.date_processor.cache_capacity=512","handlingStrategy":"validation","validationCode":"# In a pre-flight script before starting ES, validate the property is an integer:\n# [[ \"${ES_INGEST_DATE_CACHE:-256}\" =~ ^-?[0-9]+$ ]] || { echo 'bad cache_capacity'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat es.ingest.date_processor.cache_capacity as a plain integer with no units.","Audit jvm.options and ES_JAVA_OPTS for non-numeric values via configuration management.","Default to omitting the property unless you need a non-default capacity."],"tags":["ingest","date-processor","jvm-config","startup","settings"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}