prestodb/presto · error · IllegalArgumentException

shuffleWriteInfo and broadcastBasePath can not be specified

Error message

shuffleWriteInfo and broadcastBasePath can not be specified in same request

What it means

BatchTaskUpdateRequest's constructor enforces a mutual-exclusion invariant: an HTTP batch task update may carry either shuffle write info OR a broadcast base path, never both. Both Optional fields being present is an invalid request and fails fast with IllegalArgumentException.

Source

Thrown at presto-spark-base/src/main/java/com/facebook/presto/spark/execution/http/BatchTaskUpdateRequest.java:45

public final class BatchTaskUpdateRequest
{
    private final TaskUpdateRequest taskUpdateRequest;
    private final Optional<String> shuffleWriteInfo;
    private final Optional<String> broadcastBasePath;

    @JsonCreator
    public BatchTaskUpdateRequest(
            @JsonProperty("taskUpdateRequest") TaskUpdateRequest taskUpdateRequest,
            @JsonProperty("shuffleWriteInfo") Optional<String> shuffleWriteInfo,
            @JsonProperty("broadcastBasePath") Optional<String> broadcastBasePath)
    {
        this.taskUpdateRequest = requireNonNull(taskUpdateRequest, "taskUpdateRequest is null");
        this.shuffleWriteInfo = requireNonNull(shuffleWriteInfo, "shuffleWriteInfo is null");
        this.broadcastBasePath = requireNonNull(broadcastBasePath, "broadcastBasePath is null");

        // shuffleWriteInfo and broadcastBasePath, both can't have value at the same time.
        if (this.shuffleWriteInfo.isPresent() && this.broadcastBasePath.isPresent()) {
            throw new IllegalArgumentException("shuffleWriteInfo and broadcastBasePath can not be specified in same request");
        }
    }

    @JsonProperty
    public TaskUpdateRequest getTaskUpdateRequest()
    {
        return taskUpdateRequest;
    }

    @JsonProperty
    public Optional<String> getShuffleWriteInfo()
    {
        return shuffleWriteInfo;
    }

    @JsonProperty
    public Optional<String> getBroadcastBasePath()
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Send exactly one of shuffleWriteInfo or broadcastBasePath per update request
  2. Fix the client/request builder to choose the distribution mode appropriate for the task output
  3. Validate the request payload JSON before sending and drop the unused field
  4. Check for version skew between the client and the Presto-on-Spark server protocol

Example fix

// before
new BatchTaskUpdateRequest(taskUpdateRequest, Optional.of(shuffleWriteInfo), Optional.of(broadcastBasePath));
// after
new BatchTaskUpdateRequest(taskUpdateRequest, Optional.of(shuffleWriteInfo), Optional.empty());
Defensive patterns

Strategy: validation

Validate before calling

if (shuffleWriteInfo.isPresent() && broadcastBasePath.isPresent()) {
    throw new IllegalArgumentException("send only one of shuffleWriteInfo/broadcastBasePath");
}

Type guard

boolean isValidBatchUpdate(Optional<?> shuffleWriteInfo, Optional<?> broadcastBasePath) {
    return !(shuffleWriteInfo.isPresent() && broadcastBasePath.isPresent());
}

Try / catch

try {
    new BatchTaskUpdateRequest(taskUpdateRequest, shuffleWriteInfo, broadcastBasePath);
}
catch (IllegalArgumentException e) {
    if (e.getMessage().contains("shuffleWriteInfo and broadcastBasePath")) {
        // rebuild request with only one field set
    }
    throw e;
}

Prevention

When it happens

Trigger: Constructing BatchTaskUpdateRequest with both shuffleWriteInfo and broadcastBasePath non-empty — e.g. a client (or HTTP server deserializer) populating both fields in the same update payload.

Common situations: Buggy custom HTTP task clients sending both fields; deserialization of legacy/malformed JSON containing both properties; mixing shuffle-based and broadcast-based result distribution in one request.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/a8f521c7e2d8ff6f. Report an issue: GitHub.