apache/beam · error · UncheckedIOException

Failed to read broker response content

Error message

Failed to read broker response content

What it means

BrokerResponse's constructor reads the Solace management broker's HTTP response body into a string via a BufferedReader; an IOException while reading is rethrown as UncheckedIOException with this message. It indicates the broker replied but its body could not be read (stream broken/closed early).

Solutions

  1. Inspect the wrapped IOException cause for the transport-level failure (connection reset, premature EOF).
  2. Retry the management request; transient connection resets are usually resolved by re-running.
  3. Verify connectivity/TLS to the Solace management endpoint (host, port 8080/443, SEMP access).
  4. Ensure you pass a fresh, unconsumed InputStream/HttpResponse to BrokerResponse.fromHttpResponse.

Example fix

// before
BrokerResponse resp = new BrokerResponse(streamConsumedEarlier);
// after
BrokerResponse resp = BrokerResponse.fromHttpResponse(httpClient.send(request, BodyHandlers.ofInputStream()));
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight management endpoint check
// HttpClient.send(managementRequest, BodyHandlers.discarding()); // expect 200 before pipeline

Try / catch

try { pipeline.run(); }
catch (UncheckedIOException e) {
  if ("Failed to read broker response content".equals(e.getMessage())) retryManagementCall();
  else throw e;
}

Prevention

When it happens

Trigger: Solace management REST calls (e.g., queue/vpn lookups in SolaceIO Read/Write administration) where the HTTP connection is dropped mid-body, encoding mismatch, or the underlying InputStream is already consumed/closed when BrokerResponse is constructed.

Common situations: Broker/management endpoint timeouts killing the socket; intermediary proxy truncating responses; passing an InputStream previously read elsewhere; TLS or auth issues at the management port.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/9061d3786b1179d9. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/solace/src/main/java/org/apache/beam/sdk/io/solace/broker/BrokerResponse.java:45

import java.util.stream.Collectors;
import org.checkerframework.checker.nullness.qual.Nullable;

public class BrokerResponse {
  final int code;
  final String message;
  @Nullable String content;

  public BrokerResponse(int responseCode, String message, @Nullable InputStream content) {
    this.code = responseCode;
    this.message = message;
    if (content != null) {
      // Use try-with-resources so the underlying InputStream is always closed once the
      // response body has been read; otherwise the HTTP connection stream leaks.
      try (BufferedReader reader =
          new BufferedReader(new InputStreamReader(content, StandardCharsets.UTF_8))) {
        this.content = reader.lines().collect(Collectors.joining("\n"));
      } catch (IOException e) {
        throw new UncheckedIOException("Failed to read broker response content", e);
      }
    }
  }

  public static BrokerResponse fromHttpResponse(HttpResponse response) throws IOException {
    return new BrokerResponse(
        response.getStatusCode(), response.getStatusMessage(), response.getContent());
  }

  @Override
  public String toString() {
    return "BrokerResponse{"
        + "code="
        + code
        + ", message='"
        + message
        + '\''
        + ", content="

View on GitHub (pinned to 12126d8942)