apache/flink · error · CompletionException

Failed to deserialize coordination response

Error message

Failed to deserialize coordination response

What it means

Thrown when deserializing a coordination response from the JobManager fails. The sendCoordinationRequest method sends a serialized CoordinationRequest to the JobManager REST API, receives a SerializedValue response, and calls deserializeValue(getClass().getClassLoader()). An IOException (corrupted bytes) or ClassNotFoundException (response class not on client classpath) triggers this error.

Source

Thrown at flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java:612

        SerializedValue<CoordinationRequest> serializedRequest;
        try {
            serializedRequest = new SerializedValue<>(request);
        } catch (IOException e) {
            return FutureUtils.completedExceptionally(e);
        }

        ClientCoordinationRequestBody requestBody =
                new ClientCoordinationRequestBody(serializedRequest);
        return sendRequest(headers, params, requestBody)
                .thenApply(
                        responseBody -> {
                            try {
                                return responseBody
                                        .getSerializedCoordinationResponse()
                                        .deserializeValue(getClass().getClassLoader());
                            } catch (IOException | ClassNotFoundException e) {
                                throw new CompletionException(
                                        "Failed to deserialize coordination response", e);
                            }
                        });
    }

    public CompletableFuture<String> stopWithSavepoint(
            final JobID jobId,
            final boolean advanceToEndOfTime,
            @Nullable final String savepointDirectory,
            final SavepointFormatType formatType,
            final boolean isDetachedMode) {

        final StopWithSavepointTriggerHeaders stopWithSavepointTriggerHeaders =
                StopWithSavepointTriggerHeaders.getInstance();

        final SavepointTriggerMessageParameters stopWithSavepointTriggerMessageParameters =
                stopWithSavepointTriggerHeaders.getUnresolvedMessageParameters();
        stopWithSavepointTriggerMessageParameters.jobID.resolve(jobId);

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Ensure the same Flink version and user JAR versions are on both the client and the cluster classpaths.
  2. If ClassNotFoundException, add the missing JAR containing the coordination response class to the client classpath.
  3. If IOException, check for network/proxy issues that could corrupt the REST response body.
  4. Verify the operator's CoordinationResponse type is Serializable and uses a compatible serialization format.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    CoordinationResponse resp = client.sendCoordinationRequest(request).get();
} catch (ExecutionException e) {
    Throwable cause = ExceptionUtils.stripExecutionException(e);
    if (cause.getMessage().contains("Failed to deserialize coordination response")) {
        // check for ClassNotFoundException — user JAR missing on client
        if (cause.getCause() instanceof ClassNotFoundException) {
            log.error("Missing class on client: {}", cause.getCause().getMessage());
        }
    }
}

Prevention

When it happens

Trigger: Calling sendCoordinationRequest where the response object's class is not available in the RestClusterClient's classloader; class version mismatch between the client and the operator that produced the response; corrupted REST response payload.

Common situations: Client and server run different Flink versions; the operator coordination response references a class from a user JAR not loaded on the client; network corruption or REST serialization produces invalid byte payloads.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/7e20f97283ff0cb2. Report an issue: GitHub.