elastic/elasticsearch · error · IllegalArgumentException

invalid output format [{}]

Error message

invalid output format [{}]

What it means

Thrown by DateProcessor.Factory when DateFormatter.forPattern rejects the configured 'output_format' string. This is a pipeline-creation-time validation, not a per-document error: the factory probes the pattern before constructing the processor. The default output_format is 'yyyy-MM-dd\'T\'HH:mm:ss.SSSXXX'.

Source

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

        ) throws Exception {
            String field = ConfigurationUtils.readStringProperty(TYPE, tag, config, "field");
            String targetField = ConfigurationUtils.readStringProperty(TYPE, tag, config, "target_field", DEFAULT_TARGET_FIELD);
            String timezoneString = ConfigurationUtils.readOptionalStringProperty(TYPE, tag, config, "timezone");
            TemplateScript.Factory compiledTimezoneTemplate = null;
            if (timezoneString != null) {
                compiledTimezoneTemplate = ConfigurationUtils.compileTemplate(TYPE, tag, "timezone", timezoneString, scriptService);
            }
            String localeString = ConfigurationUtils.readOptionalStringProperty(TYPE, tag, config, "locale");
            TemplateScript.Factory compiledLocaleTemplate = null;
            if (localeString != null) {
                compiledLocaleTemplate = ConfigurationUtils.compileTemplate(TYPE, tag, "locale", localeString, scriptService);
            }
            List<String> formats = ConfigurationUtils.readList(TYPE, tag, config, "formats");
            String outputFormat = ConfigurationUtils.readStringProperty(TYPE, tag, config, "output_format", DEFAULT_OUTPUT_FORMAT);
            try {
                DateFormatter.forPattern(outputFormat);
            } catch (Exception e) {
                throw new IllegalArgumentException("invalid output format [" + outputFormat + "]", e);
            }

            return new DateProcessor(
                tag,
                description,
                compiledTimezoneTemplate,
                compiledLocaleTemplate,
                field,
                formats,
                targetField,
                outputFormat
            );
        }
    }

    /**
     * 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.

View on GitHub (pinned to db6a809a66)

Solutions

  1. Use java-time pattern letters (y not Y for year, except where week-based is intended; SSS for millis; X/X/X for zone offsets).
  2. Quote literal text with single quotes (e.g. 'yyyy-MM-dd\'T\'HH:mm:ss.SSSXXX').
  3. Test the pattern with java.time.format.DateTimeFormatter.ofPattern in isolation before deploying.
  4. Omit output_format to accept the default ISO-8601 with millis and offset.

Example fix

// before - invalid pattern letters
{"date": {"field": "ts", "formats": ["ISO8601"], "output_format": "YYYY-MM-DD"}}
// after - valid java-time pattern
{"date": {"field": "ts", "formats": ["ISO8601"], "output_format": "yyyy-MM-dd"}}
Defensive patterns

Strategy: validation

Validate before calling

// Validate the output_format in isolation in CI before deploying the pipeline:
// java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd").parse("2024-01-01");

Prevention

When it happens

Trigger: Configuring a date processor with an 'output_format' that uses invalid Joda or unsupported java-time pattern letters, or unsupported literals. The error is raised when the pipeline is created/updated.

Common situations: Copy-pasting Joda-style patterns (e.g. 'YYYY-MM-dd HH:mm:ss ZZ') that map poorly to java-time; using unsupported letters; quoting mistakes where a literal is not properly escaped; version upgrades where the underlying DateFormatter moved from Joda to java-time semantics.

Related errors


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