apache/druid · error · DruidException

(dynamic msg passed to InvalidInput.exception with cause)

Error message

%s (dynamic msg passed to InvalidInput.exception with cause)

What it means

This is Druid's InvalidInput exception raised via the conditionalException helper in processing/src/main/java/org/apache/druid/error/InvalidInput.java. When the boolean condition is false, the supplied message (formatted with args) is wrapped in an InvalidInput exception along with the given cause. It signals caller-supplied input that violates an API precondition, and the actual message text is dynamic, supplied by each call site.

Solutions

  1. Read the dynamic message in the exception text to identify which precondition failed and which parameter was rejected.
  2. Correct the offending input parameter at the call site per the message.
  3. Inspect the attached cause (Throwable t) for the underlying reason.
  4. If you own the call site, ensure the condition check matches documented API constraints.

Example fix

// before
conditionalException(!isValidDatasource(name), t, "invalid datasource %s", name);
// after
// validate/normalize input first
String validated = normalizeDatasource(name);
conditionalException(!isValidDatasource(validated), t, "invalid datasource %s", validated);
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Any call to ApiPredicate/InvalidInput.conditionalException(condition, t, msg, args) where the condition evaluates to false; the dynamic msg text identifies the violated precondition at that specific call site.

Common situations: Query/ingestion API handlers validating user-supplied parameters (datasource names, intervals, filters); malformed REST request bodies; programmatic API misuse passing nulls or out-of-range values.

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/b086dc2778d9b860. Report an issue: GitHub.

Appendix: source

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

  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()
   */

  public static void conditionalException(boolean condition, Throwable t, String msg, Object... args)
  {
    if (!condition) {
      throw exception(t, msg, args);
    }
  }


  public InvalidInput(
      Throwable t,
      String msg,
      Object... args
  )
  {
    super(
        "invalidInput",
        DruidException.Persona.USER,
        DruidException.Category.INVALID_INPUT,
        t, msg, args
    );
  }

View on GitHub (pinned to 9b90983fd2)