alibaba/canal · warning · RuntimeException

http request failed! {result}

Error message

http request failed! {result}

What it means

Thrown by AbstractRequest.doAction() after executeHttpRequest() returns a response whose status code is not 200 OK. This is a secondary check — it fires when executeHttpRequest allowed a response through (e.g., status 206 Partial Content) but doAction requires strictly 200.

Source

Thrown at parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/request/AbstractRequest.java:239

            throw new RuntimeException("return error !" + response.getStatusLine().getReasonPhrase() + ", " + result);
        }
        return response;
    }

    protected abstract T processResult(HttpResponse response) throws Exception;

    protected void processBefore() {

    }

    public final T doAction() throws Exception {
        processBefore();
        String requestStr = makeRequestString(treeMap);
        HttpGet httpGet = new HttpGet(protocol + "://" + endPoint + "?" + requestStr);
        HttpResponse response = executeHttpRequest(httpGet, endPoint);
        if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
            String result = EntityUtils.toString(response.getEntity());
            throw new RuntimeException("http request failed! " + result);
        }
        return processResult(response);
    }
}

View on GitHub (pinned to 87be50e876)

Solutions

  1. Check the response body in the error message for the server-side explanation.
  2. If status is 206, this may be a legitimate response that the code should handle — consider overriding doAction or processResult to accept 206.
  3. Verify the request parameters are correct for the specific RDS API action being called.
  4. If the status is a redirect, ensure the httpClient follows redirects or the URL is the final destination.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    T result = request.doAction();
} catch (RuntimeException e) {
    if (e.getMessage().startsWith("http request failed!")) {
    // inspect the result body for the specific error
    }
}

Prevention

When it happens

Trigger: executeHttpRequest passes the initial check (status 200 or 206), but doAction's subsequent check rejects any non-200 status. This means a 206 Partial Content response would pass executeHttpRequest but be rejected here. The response body is read and included in the error.

Common situations: Server returns 206 Partial Content for range requests which executeHttpRequest allows but doAction rejects; edge case where the response status changes between the two checks (unlikely); the API returns a redirect (3xx) that was not followed.

Related errors


AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14). Data as JSON: /api/errors/570b91ae6970c750. Report an issue: GitHub.