apache/druid · error · IllegalArgumentException

useJsonNodeReader cannot be set to true when assumeNewlineDe

Error message

useJsonNodeReader cannot be set to true when assumeNewlineDelimited is true.

What it means

JsonInputFormat's constructor forbids combining assumeNewlineDelimited=true with useJsonNodeReader=true. The newline-delimited fast path and the streaming JsonNodeReader path are mutually exclusive implementation strategies, so the format refuses the ambiguous configuration with IAE.

Source

Thrown at processing/src/main/java/org/apache/druid/data/input/impl/JsonInputFormat.java:110

      Boolean keepNullColumns,
      boolean lineSplittable,
      Boolean assumeNewlineDelimited,
      Boolean useJsonNodeReader
  )
  {
    super(flattenSpec);
    this.featureSpec = featureSpec == null ? Collections.emptyMap() : featureSpec;
    this.objectMapper = new ObjectMapper();
    this.keepNullColumns = keepNullColumns;
    for (Entry<String, Boolean> entry : this.featureSpec.entrySet()) {
      Feature feature = Feature.valueOf(entry.getKey());
      objectMapper.configure(feature, entry.getValue());
    }
    this.lineSplittable = lineSplittable;
    this.assumeNewlineDelimited = assumeNewlineDelimited != null && assumeNewlineDelimited;
    this.useJsonNodeReader = useJsonNodeReader != null && useJsonNodeReader;
    if (this.assumeNewlineDelimited && this.useJsonNodeReader) {
      throw new IAE("useJsonNodeReader cannot be set to true when assumeNewlineDelimited is true.");
    }
  }

  @JsonProperty
  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  public Map<String, Boolean> getFeatureSpec()
  {
    return featureSpec;
  }

  boolean isLineSplittable()
  {
    return lineSplittable;
  }

  public boolean isKeepNullColumns()
  {
    if (keepNullColumns != null) {

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Remove "useJsonNodeReader": true if newline-delimited fast parsing is the priority
  2. Or remove "assumeNewlineDelimited": true if you need the JsonNodeReader
  3. Keep both flags unset (defaults) unless a specific optimization is required

Example fix

// before
{"type":"json","assumeNewlineDelimited":true,"useJsonNodeReader":true}
// after
{"type":"json","assumeNewlineDelimited":true}
Defensive patterns

Strategy: validation

Validate before calling

// Before submitting the JSON inputFormat spec
if (Boolean.TRUE.equals(fmt.get("assumeNewlineDelimited")) && Boolean.TRUE.equals(fmt.get("useJsonNodeReader"))) {
    fmt.remove("useJsonNodeReader");
}

Try / catch

try { new JsonInputFormat(..., lineSplittable, assumeNewlineDelimited, useJsonNodeReader, ...); } catch (IAE e) { /* drop one flag and rebuild */ }

Prevention

When it happens

Trigger: Submitting an inputFormat of type 'json' with both "assumeNewlineDelimited": true and "useJsonNodeReader": true in the spec.

Common situations: Merging two performance-tuned spec templates, each enabling one of the flags; blindly enabling all JSON performance options to speed up ingestion.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/59a0454be57ede64. Report an issue: GitHub.