apache/druid · error · DruidException

(dynamic msg passed to InvalidInput.exception)

Error message

%s (dynamic msg passed to InvalidInput.exception)

What it means

InvalidInput.conditionalException(condition, msg, args) throws an InvalidInput DruidException (user-persona, 400-class) when the condition is false. It is Druid's convenience guard for caller-supplied values; the placeholder message here is replaced by the dynamic msg passed at the call site (e.g., '%s must not be null'). Seeing it means an argument you supplied failed a validity check.

Solutions

  1. Read the dynamic message to identify which argument/field failed validation.
  2. Supply the missing or corrected value required by the failing check.
  3. Validate the spec JSON against the Druid schema/docs before submission.
  4. If you believe the input is valid, verify field names and casing match the current Druid version's API.

Example fix

// before: null required argument
IngestionSpec.builder().dataSource(null).build();
// after: provide required field
IngestionSpec.builder().dataSource("wikipedia").build();
Defensive patterns

Strategy: validation

Validate before calling

if (value == null) throw new IllegalArgumentException(name + " must not be null");
// run before invoking the Druid API

Type guard

static <T> T requireNonNull(T val, String name) {
  if (val == null) throw new IllegalArgumentException(name + " must not be null");
  return val;
}

Try / catch

try { druidApi(input); } catch (DruidException e) {
  if (e.getCategory() == DruidException.Category.INVALID_INPUT) {
    log.error("rejected input: {}", e.getMessage()); // fix and retry with corrected input
  }
  throw e;
}

Prevention

When it happens

Trigger: Any Druid API that calls InvalidInput.conditionalException(cond, ...) with a false condition — typically null or malformed inputs such as passing null to InvalidInput.notNull(val, name) or otherwise invalid configuration/JSON fields.

Common situations: Omitting a required field in a spec JSON; passing null for a required parameter; supplying values of the wrong format to ingestion/query spec builders; typos in field names causing defaults to be null.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at processing/src/main/java/org/apache/druid/error/InvalidInput.java:50

    return exception(null, msg, args);
  }

  public static DruidException exception(Throwable t, String msg, Object... args)
  {
    return DruidException.fromFailure(new InvalidInput(t, msg, args));
  }

  /**
   * evalues a condition. If it's false, it throws the appropriate DruidException
   *
   * @param condition - boolean condition to validate
   * @param msg - passed through to DruidException.exception()
   * @param args - passed through to DruidException.exception()
   */
  public static void conditionalException(boolean condition, String msg, Object... args)
  {
    if (!condition) {
      throw exception(msg, args);
    }
  }

  public static <T> T notNull(@Nullable T val, String name)
  {
    InvalidInput.conditionalException(val != null, "%s must not be null", name);
    return val;
  }

  /**
   * evalues a condition. If it's false, it throws the appropriate DruidException with a given cause
   *
   * @param condition - boolean condition to validate
   * @param t - throwable to pass to InvalidInput.exception()
   * @param msg - passed through to InvalidInput.exception()
   * @param args - passed through to InvalidInput.exception()
   */

View on GitHub (pinned to 9b90983fd2)