{"record":{"id":"a8f521c7e2d8ff6f","repo":"prestodb/presto","slug":"shufflewriteinfo-and-broadcastbasepath-can-not-be","errorCode":null,"errorMessage":"shuffleWriteInfo and broadcastBasePath can not be specified in same request","messagePattern":"shuffleWriteInfo and broadcastBasePath can not be specified in same request","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-spark-base/src/main/java/com/facebook/presto/spark/execution/http/BatchTaskUpdateRequest.java","lineNumber":45,"sourceCode":"public final class BatchTaskUpdateRequest\n{\n    private final TaskUpdateRequest taskUpdateRequest;\n    private final Optional<String> shuffleWriteInfo;\n    private final Optional<String> broadcastBasePath;\n\n    @JsonCreator\n    public BatchTaskUpdateRequest(\n            @JsonProperty(\"taskUpdateRequest\") TaskUpdateRequest taskUpdateRequest,\n            @JsonProperty(\"shuffleWriteInfo\") Optional<String> shuffleWriteInfo,\n            @JsonProperty(\"broadcastBasePath\") Optional<String> broadcastBasePath)\n    {\n        this.taskUpdateRequest = requireNonNull(taskUpdateRequest, \"taskUpdateRequest is null\");\n        this.shuffleWriteInfo = requireNonNull(shuffleWriteInfo, \"shuffleWriteInfo is null\");\n        this.broadcastBasePath = requireNonNull(broadcastBasePath, \"broadcastBasePath is null\");\n\n        // shuffleWriteInfo and broadcastBasePath, both can't have value at the same time.\n        if (this.shuffleWriteInfo.isPresent() && this.broadcastBasePath.isPresent()) {\n            throw new IllegalArgumentException(\"shuffleWriteInfo and broadcastBasePath can not be specified in same request\");\n        }\n    }\n\n    @JsonProperty\n    public TaskUpdateRequest getTaskUpdateRequest()\n    {\n        return taskUpdateRequest;\n    }\n\n    @JsonProperty\n    public Optional<String> getShuffleWriteInfo()\n    {\n        return shuffleWriteInfo;\n    }\n\n    @JsonProperty\n    public Optional<String> getBroadcastBasePath()\n    {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-spark-base/src/main/java/com/facebook/presto/spark/execution/http/BatchTaskUpdateRequest.java#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Send exactly one of shuffleWriteInfo or broadcastBasePath per update request","Fix the client/request builder to choose the distribution mode appropriate for the task output","Validate the request payload JSON before sending and drop the unused field","Check for version skew between the client and the Presto-on-Spark server protocol"],"exampleFix":"// before\nnew BatchTaskUpdateRequest(taskUpdateRequest, Optional.of(shuffleWriteInfo), Optional.of(broadcastBasePath));\n// after\nnew BatchTaskUpdateRequest(taskUpdateRequest, Optional.of(shuffleWriteInfo), Optional.empty());","handlingStrategy":"validation","validationCode":"if (shuffleWriteInfo.isPresent() && broadcastBasePath.isPresent()) {\n    throw new IllegalArgumentException(\"send only one of shuffleWriteInfo/broadcastBasePath\");\n}","typeGuard":"boolean isValidBatchUpdate(Optional<?> shuffleWriteInfo, Optional<?> broadcastBasePath) {\n    return !(shuffleWriteInfo.isPresent() && broadcastBasePath.isPresent());\n}","tryCatchPattern":"try {\n    new BatchTaskUpdateRequest(taskUpdateRequest, shuffleWriteInfo, broadcastBasePath);\n}\ncatch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"shuffleWriteInfo and broadcastBasePath\")) {\n        // rebuild request with only one field set\n    }\n    throw e;\n}","preventionTips":["Build requests through a helper that enforces one-of semantics","Validate JSON payloads against a schema with oneOf constraints","Pin client/server protocol versions to avoid skew","Unit-test request builders for both distribution modes"],"tags":["http","request-validation","spark","illegal-argument"],"backgroundTag":"mutually-exclusive-request-fields","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}