{"record":{"id":"718ee404419e0cf0","repo":"alibaba/canal","slug":"requestpost-remote-error-request-statuscode-718ee4","errorCode":null,"errorMessage":"requestPost remote error, request : {}, statusCode={};{}","messagePattern":"requestPost remote error, request : (.+?), statusCode=(.+?);(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/HttpHelper.java","lineNumber":301,"sourceCode":"                parameters.add(nameValuePair);\n            }\n            httpPost.setEntity(new UrlEncodedFormEntity(parameters, Charset.forName(\"UTF-8\")));\n            HttpClientContext context = HttpClientContext.create();\n            context.setRequestConfig(config);\n            context.setCookieStore(cookieStore);\n\n            response = httpclient.execute(httpPost, context);\n            int statusCode = response.getStatusLine().getStatusCode();\n            if (statusCode == HttpStatus.SC_OK) {\n                long end = System.currentTimeMillis();\n                long cost = end - start;\n                printCurlRequest(url, cookieStore, params, cost);\n                return EntityUtils.toString(response.getEntity());\n            } else {\n                long end = System.currentTimeMillis();\n                long cost = end - start;\n                String curlRequest = getCurlRequest(url, cookieStore, params, cost);\n                throw new RuntimeException(\"requestPost remote error, request : \" + curlRequest + \", statusCode=\"\n                                           + statusCode + \";\" + EntityUtils.toString(response.getEntity()));\n            }\n        } catch (Throwable t) {\n            long end = System.currentTimeMillis();\n            long cost = end - start;\n            String curlRequest = getCurlRequest(url, cookieStore, params, cost);\n            throw new RuntimeException(\"requestPost remote error, request : \" + curlRequest, t);\n        } finally {\n            if (response != null) {\n                try {\n                    response.close();\n                } catch (IOException e) {\n                }\n            }\n            if (httpPost != null) {\n                httpPost.releaseConnection();\n            }\n        }","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/HttpHelper.java#L283-L319","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the response body text after the semicolon in the exception message to get the specific server-side error reason.","Fix the POST parameters or authentication based on the error body content.","Verify the URL is correct and the endpoint expects form-urlencoded POST data (as sent by UrlEncodedFormEntity).","If the response indicates the URL should use HTTPS, switch the URL scheme to https."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    String result = HttpHelper.post(url, cookieStore, params, timeout);\n} catch (RuntimeException e) {\n    // Parse statusCode and response body from message after 'statusCode='\n    String msg = e.getMessage();\n    int statusCodeStart = msg.indexOf(\"statusCode=\");\n    // extract and handle accordingly\n}","preventionTips":["Validate POST parameters match the API contract before sending.","Use HTTPS URLs instead of HTTP for RDS endpoints to avoid redirect issues.","Ensure the cookie/session is valid and not expired."],"tags":["http","rds","network","post","api-error"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}