apache/druid · error · IAE

At most one of [ ] or [ ] must be present

Error message

At most one of [%s] or [%s] must be present

What it means

Checks.checkAtMostOneNotNull is a config validation helper: given two mutually exclusive properties, it returns the one that is set (or the first if both are null, with -1 treated as null for historical reasons) and throws this IAE only when both are non-null, i.e. the user supplied conflicting values.

Solutions

  1. Remove one of the two conflicting properties from the ingestion spec, keeping only the intended one.
  2. Check for duplicated/merged config files that set both properties.
  3. Consult the Hadoop batch task docs for which of the pair is supported for your job type.

Example fix

// before
"partitionSpec": {...},
"shardSpec": {...}
// after
"partitionSpec": {...}
Defensive patterns

Strategy: validation

Validate before calling

if (prop1.getValue() != null && prop2.getValue() != null) { throw new IllegalArgumentException("Only one of prop1/prop2 may be set"); }

Try / catch

try { Checks.checkAtMostOneNotNull(p1, p2); } catch (IAE e) { log.error("Conflicting properties: {}", e.getMessage()); throw e; }

Prevention

When it happens

Trigger: Constructing a Hadoop indexing config where two alternative properties (e.g. partitionSpec vs. shardSpec, or two segment-output options) are both supplied.

Common situations: Merging spec templates so both the old and new config fields end up set; copying an existing spec and adding a second option without deleting the first.

Related errors


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/indexer/Checks.java:73

  /**
   * @return Non-null value, or first one if both are null. -1 is interpreted as null for historical reasons.
   */
  public static <T> Property<T> checkAtMostOneNotNull(Property<T> property1, Property<T> property2)
  {
    final Property<T> property;

    boolean isNull1 = property1.getValue() == null;
    boolean isNull2 = property2.getValue() == null;

    if (isNull1 && isNull2) {
      property = property1;
    } else if (isNull1) {
      property = property2;
    } else if (isNull2) {
      property = property1;
    } else {
      throw new IAE("At most one of [%s] or [%s] must be present", property1, property2);
    }

    return property;
  }

  /**
   * @return Non-null value, or first one if both are null. -1 is interpreted as null for historical reasons.
   */
  public static <T> Property<T> checkAtMostOneNotNull(String name1, T value1, String name2, T value2)
  {
    Property<T> property1 = new Property<>(name1, value1);
    Property<T> property2 = new Property<>(name2, value2);
    return checkAtMostOneNotNull(property1, property2);
  }

  private Checks()
  {
  }

View on GitHub (pinned to 9b90983fd2)