{"record":{"id":"b5084558f4f1ac2f","repo":"alibaba/canal","slug":"requestpost-remote-error-request-b50845","errorCode":null,"errorMessage":"requestPost remote error, request : {}","messagePattern":"requestPost remote error, request : (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/HttpHelper.java","lineNumber":308,"sourceCode":"            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        }\n    }\n\n    public static void printCurlRequest(String url, CookieStore cookieStore, Map<String, String> params, long cost) {\n        logger.warn(getCurlRequest(url, cookieStore, params, cost));\n    }\n\n    private static String getCurlRequest(String url, CookieStore cookieStore, Map<String, String> params, long cost) {","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/alibaba/canal/blob/87be50e87686a3e8af08c368d0e1ffd1f59eb04a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/rds/HttpHelper.java#L290-L326","documentation":"Thrown by the catch (Throwable t) block in HttpHelper.post() as an outer wrapper for ANY exception during the plain HTTP POST. Includes a curl-equivalent request string with cookies and params. The original exception is preserved as the cause.","triggerScenarios":"Any Throwable during HttpHelper.post(): the inner non-200 throw (error 426), ConnectException, SocketTimeoutException, IOException from entity writing, or NullPointerException if params map is null when iterating keys.","commonSituations":"Connection refused by the target service; socket timeout during slow POST response; params map is null causing NPE in the for loop at line 281; CookieStore.getCookies() throwing when cookieStore is null but params are non-null.","solutions":["Check the cause exception for the real root cause.","If cause is NullPointerException, ensure params is non-null before calling post().","If cause is ConnectException, verify the target host and port are reachable.","If cause is the inner RuntimeException (error 426), follow error 426 solutions."],"exampleFix":"// before\nHttpHelper.post(url, cookieStore, null, timeout);\n\n// after\nMap<String, String> params = new HashMap<>(); // ensure non-null\nHttpHelper.post(url, cookieStore, params, timeout);","handlingStrategy":"validation","validationCode":"// Validate params is non-null before calling post\nif (params == null) {\n    params = new java.util.HashMap<>();\n}\nif (url == null || url.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"URL must not be null or empty\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    String result = HttpHelper.post(url, cookieStore, params, timeout);\n} catch (RuntimeException e) {\n    Throwable cause = e.getCause();\n    if (cause instanceof NullPointerException) {\n        // likely params or cookieStore was null\n    } else if (cause instanceof java.net.ConnectException) {\n        // endpoint unreachable\n    }\n}","preventionTips":["Always pass a non-null params map (use empty map if no params).","Validate URL format and reachability before calling post().","Initialize CookieStore before passing to post()."],"tags":["http","rds","network","post","error-wrapping"],"backgroundTag":null,"analyzedSha":"87be50e87686a3e8af08c368d0e1ffd1f59eb04a","analyzedAt":"2026-08-14T04:30:11.918Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}