alibaba/canal · error · RuntimeException

requestPost remote error, request : {}, statusCode={};{}

Error message

requestPost remote error, request : {}, statusCode={};{}

What it means

Thrown by HttpHelper.post() (plain HTTP POST) when the remote server returns a non-200 status code. Unlike the HTTPS variant (error 424), this message includes BOTH the statusCode AND the response entity body (after a semicolon), giving more diagnostic information.

Source

Thrown at parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/HttpHelper.java:301

                parameters.add(nameValuePair);
            }
            httpPost.setEntity(new UrlEncodedFormEntity(parameters, Charset.forName("UTF-8")));
            HttpClientContext context = HttpClientContext.create();
            context.setRequestConfig(config);
            context.setCookieStore(cookieStore);

            response = httpclient.execute(httpPost, context);
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode == HttpStatus.SC_OK) {
                long end = System.currentTimeMillis();
                long cost = end - start;
                printCurlRequest(url, cookieStore, params, cost);
                return EntityUtils.toString(response.getEntity());
            } else {
                long end = System.currentTimeMillis();
                long cost = end - start;
                String curlRequest = getCurlRequest(url, cookieStore, params, cost);
                throw new RuntimeException("requestPost remote error, request : " + curlRequest + ", statusCode="
                                           + statusCode + ";" + EntityUtils.toString(response.getEntity()));
            }
        } catch (Throwable t) {
            long end = System.currentTimeMillis();
            long cost = end - start;
            String curlRequest = getCurlRequest(url, cookieStore, params, cost);
            throw new RuntimeException("requestPost remote error, request : " + curlRequest, t);
        } finally {
            if (response != null) {
                try {
                    response.close();
                } catch (IOException e) {
                }
            }
            if (httpPost != null) {
                httpPost.releaseConnection();
            }
        }

View on GitHub (pinned to 87be50e876)

Solutions

  1. Read the response body text after the semicolon in the exception message to get the specific server-side error reason.
  2. Fix the POST parameters or authentication based on the error body content.
  3. Verify the URL is correct and the endpoint expects form-urlencoded POST data (as sent by UrlEncodedFormEntity).
  4. If the response indicates the URL should use HTTPS, switch the URL scheme to https.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    String result = HttpHelper.post(url, cookieStore, params, timeout);
} catch (RuntimeException e) {
    // Parse statusCode and response body from message after 'statusCode='
    String msg = e.getMessage();
    int statusCodeStart = msg.indexOf("statusCode=");
    // extract and handle accordingly
}

Prevention

When it happens

Trigger: Calling HttpHelper.post(url, cookieStore, params, timeout) with a plain http:// URL that returns non-200. The response body is read via EntityUtils.toString() and appended to the error message after the status code.

Common situations: RDS or internal service endpoint returning an error JSON body (e.g. {"code":"InvalidParameter","message":"..."}); authentication failure with 401/403; resource not found with 404; invalid POST parameters causing a 400 Bad Request.

Related errors


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