{"record":{"id":"ba07f37b73f7bccf","repo":"elastic/elasticsearch","slug":"invalid-language-tag-specified","errorCode":null,"errorMessage":"Invalid language tag specified: {}","messagePattern":"Invalid language tag specified: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateIndexNameProcessor.java","lineNumber":165,"sourceCode":"        }\n\n        @Override\n        public DateIndexNameProcessor create(\n            Map<String, Processor.Factory> registry,\n            String tag,\n            String description,\n            Map<String, Object> config,\n            ProjectId projectId\n        ) throws Exception {\n            String localeString = ConfigurationUtils.readOptionalStringProperty(TYPE, tag, config, \"locale\");\n            String timezoneString = ConfigurationUtils.readOptionalStringProperty(TYPE, tag, config, \"timezone\");\n            ZoneId timezone = timezoneString == null ? ZoneOffset.UTC : ZoneId.of(timezoneString);\n            Locale locale = Locale.ENGLISH;\n            if (localeString != null) {\n                try {\n                    locale = (new Locale.Builder()).setLanguageTag(localeString).build();\n                } catch (IllformedLocaleException e) {\n                    throw new IllegalArgumentException(\"Invalid language tag specified: \" + localeString);\n                }\n            }\n            List<String> dateFormatStrings = ConfigurationUtils.readOptionalList(TYPE, tag, config, \"date_formats\");\n            if (dateFormatStrings == null) {\n                dateFormatStrings = Collections.singletonList(\"yyyy-MM-dd'T'HH:mm:ss.SSSXX\");\n            }\n            List<Function<String, ZonedDateTime>> dateFormats = new ArrayList<>(dateFormatStrings.size());\n            for (String format : dateFormatStrings) {\n                DateFormat dateFormat = DateFormat.fromString(format);\n                dateFormats.add(dateFormat.getFunction(format, timezone, locale));\n            }\n\n            String field = ConfigurationUtils.readStringProperty(TYPE, tag, config, \"field\");\n            String indexNamePrefix = ConfigurationUtils.readStringProperty(TYPE, tag, config, \"index_name_prefix\", \"\");\n            TemplateScript.Factory indexNamePrefixTemplate = ConfigurationUtils.compileTemplate(\n                TYPE,\n                tag,\n                \"index_name_prefix\",","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/DateIndexNameProcessor.java#L147-L183","documentation":"Thrown by DateIndexNameProcessor.Factory when java.util.Locale.Builder.setLanguageTag rejects the configured 'locale' string with IllformedLocaleException. The factory catches the IllformedLocaleException and rethrows as IllegalArgumentException. A valid BCP 47 tag (e.g. 'en-US') is required; malformed tags do not fall back to the default English locale.","triggerScenarios":"Configuring the date_index_name processor's 'locale' option with a string that violates BCP 47 syntax, e.g. 'en_US' (underscore), 'english', 'en-US-x', or trailing subtags.","commonSituations":"Developers using underscore-separated locale strings (common in Java resource bundles) instead of hyphenated BCP 47; copy-pasting locale names from other systems; locale typos.","solutions":["Use a hyphenated BCP 47 language tag such as 'en-US', 'fr-FR', 'de', 'ja-JP'.","Omit the 'locale' option to fall back to the default Locale.ENGLISH.","Validate the locale string with java.util.Locale.LanguageRange.parse or Locale.forLanguageTag before deploying."],"exampleFix":"// before\n{\"date_index_name\": {\"field\": \"ts\", \"index_name_prefix\": \"logs-\", \"date_rounding\": \"d\", \"locale\": \"en_US\"}}\n// after\n{\"date_index_name\": {\"field\": \"ts\", \"index_name_prefix\": \"logs-\", \"date_rounding\": \"d\", \"locale\": \"en-US\"}}","handlingStrategy":"validation","validationCode":"// Validate the locale string with java before deploying (outside ES, e.g. in CI pipeline validation):\n// Locale.forLanguageTag(\"en-US\");  // ok\n// Locale.forLanguageTag(\"en_US\"); // silently lenient; use Locale.Builder to validate BCP47 strictly:\nnew Locale.Builder().setLanguageTag(\"en-US\").build();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use hyphenated BCP 47 tags ('en-US', 'fr-FR').","Omit the locale option when English is acceptable.","Validate locale strings in CI by running a dry pipeline creation."],"tags":["ingest","date-index-name","locale","config"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}