apache/druid · error · IllegalArgumentException

No such shuffleKind[%s]

Error message

No such shuffleKind[%s]

What it means

ShuffleKind.fromString parses a user- or config-supplied string into one of the known shuffle kinds. It iterates all enum values and compares against each kind's string form; if no kind matches, it throws IllegalArgumentException("No such shuffleKind[%s]"). This guards against typo'd or unknown shuffle kind identifiers entering query spec parsing.

Source

Thrown at multi-stage-query/src/main/java/org/apache/druid/msq/kernel/ShuffleKind.java:87

  private final boolean sort;

  ShuffleKind(String name, boolean hash, boolean sort)
  {
    this.name = name;
    this.hash = hash;
    this.sort = sort;
  }

  @JsonCreator
  public static ShuffleKind fromString(final String s)
  {
    for (final ShuffleKind kind : values()) {
      if (kind.toString().equals(s)) {
        return kind;
      }
    }

    throw new IAE("No such shuffleKind[%s]", s);
  }

  /**
   * Whether this shuffle does hash-partitioning.
   */
  public boolean isHash()
  {
    return hash;
  }

  /**
   * Whether this shuffle sorts within partitions. (If true, it may, or may not, also sort globally.)
   */
  public boolean isSort()
  {
    return sort;
  }

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Print the valid values by iterating ShuffleKind.values() and use the exact string returned by toString()
  2. Check the Druid version: upgrade/downgrade so the shuffle kind string matches the enum spelling of the running cluster
  3. If parsing untrusted input, call fromString inside validation and reject the spec before query submission

Example fix

// before
ShuffleSpec spec = new HashShuffleSpecBuilder().clusterBy(...).build(); // JSON had "kind": "hash"
// after
// JSON: "kind": "HASH" (exact ShuffleKind enum string)
ShuffleKind kind = ShuffleKind.fromString(specJson.get("kind").asText());
Defensive patterns

Strategy: validation

Validate before calling

boolean known = java.util.Arrays.stream(ShuffleKind.values())
    .anyMatch(k -> k.toString().equals(s));
if (!known) throw new IllegalArgumentException("Unknown shuffleKind: " + s);

Try / catch

try { kind = ShuffleKind.fromString(s); } catch (IllegalArgumentException e) { /* fall back to default or reject spec */ }

Prevention

When it happens

Trigger: Calling ShuffleKind.fromString(s) with a string that does not equal the toString() of any ShuffleKind enum constant — e.g. hand-written query JSON with "shuffleKind":"HASH_SHUFFLE" instead of the exact enum string, or deserializing a spec written by a different Druid version whose enum spelling changed.

Common situations: Hand-editing native MSQ query JSON, replaying stored queries from an older Druid version, or a custom extension emitting a shuffle kind string the core does not know.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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