{"record":{"id":"11bc11931dd2f7d9","repo":"apache/dolphinscheduler","slug":"put-request-execute-failed-url-s","errorCode":null,"errorMessage":"Put request execute failed, url: %s","messagePattern":"Put request execute failed, url: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OkHttpUtils.java","lineNumber":125,"sourceCode":"     */\n    public static @NonNull OkHttpResponse put(@NonNull String url,\n                                              @Nullable OkHttpRequestHeaders okHttpRequestHeaders,\n                                              @Nullable Map<String, Object> requestBodyMap,\n                                              int connectTimeout,\n                                              int writeTimeout,\n                                              int readTimeout) throws IOException {\n        OkHttpClient client = getHttpClient(connectTimeout, writeTimeout, readTimeout);\n        Request.Builder requestBuilder = new Request.Builder().url(url);\n        addHeader(okHttpRequestHeaders.getHeaders(), requestBuilder);\n        if (requestBodyMap != null) {\n            requestBuilder = requestBuilder.put(RequestBody.create(\n                    JSONUtils.toJsonString(requestBodyMap),\n                    MediaType.parse(okHttpRequestHeaders.getOkHttpRequestHeaderContentType().getValue())));\n        }\n        try (Response response = client.newCall(requestBuilder.build()).execute()) {\n            return new OkHttpResponse(response.code(), getResponseBody(response));\n        } catch (Exception e) {\n            throw new RuntimeException(String.format(\"Put request execute failed, url: %s\", url), e);\n        }\n    }\n\n    /**\n     * http delete request\n     * @param connectTimeout connect timeout in milliseconds\n     * @param writeTimeout write timeout in milliseconds\n     * @param readTimeout read timeout in milliseconds\n     * @return OkHttpResponse\n     * @throws RuntimeException\n     */\n    public static @NonNull OkHttpResponse delete(@NonNull String url,\n                                                 @Nullable OkHttpRequestHeaders okHttpRequestHeaders,\n                                                 int connectTimeout,\n                                                 int writeTimeout,\n                                                 int readTimeout) throws IOException {\n        OkHttpClient client = getHttpClient(connectTimeout, writeTimeout, readTimeout);\n        Request.Builder requestBuilder = new Request.Builder().url(url);","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OkHttpUtils.java#L107-L143","documentation":"OkHttpUtils.put() wraps any failure while executing an OkHttp PUT call (connection errors, timeouts, IO errors, non-recoverable client problems) into a RuntimeException that names the target URL. The original exception is preserved as the cause. It signals the HTTP PUT request never completed successfully at the transport layer.","triggerScenarios":"Calling OkHttpUtils.put(...) when the server is unreachable, connection is refused or reset, TLS handshake fails, read/connect timeout elapses, or the response body cannot be read inside client.newCall(...).execute().","commonSituations":"Target service down or wrong port in configured URL; DNS misconfiguration; firewall blocking outbound calls; slow endpoint exceeding the configured connectTimeout; calling an HTTPS endpoint with a bad certificate trust store.","solutions":["Verify the target URL is reachable (curl -X PUT the same URL from the same host).","Check the wrapped cause in the stack trace to distinguish connect timeout, refused connection, or TLS error.","Increase connectTimeout/readTimeout passed to put(...) if the server is slow.","Ensure the remote service is running and network/firewall allows the connection."],"exampleFix":"// before\nOkHttpUtils.put(url, params, headers);\n// after\ntry {\n    OkHttpResponse resp = OkHttpUtils.put(url, params, headers);\n} catch (RuntimeException e) {\n    log.error(\"PUT to {} failed: {}\", url, e.getCause(), e);\n    throw new ServiceException(\"Upstream PUT failed\", e);\n}","handlingStrategy":"try-catch","validationCode":"HttpUrl parsed = HttpUrl.parse(url);\nif (parsed == null) throw new IllegalArgumentException(\"Bad PUT url: \" + url);","typeGuard":null,"tryCatchPattern":"try {\n    OkHttpResponse r = OkHttpUtils.put(url, params, headers);\n} catch (RuntimeException e) {\n    log.error(\"PUT {} failed: {}\", url, e.getCause(), e);\n    throw new ServiceException(e);\n}","preventionTips":["Health-check the endpoint URL before calling.","Set explicit connect/read timeouts appropriate for the endpoint.","Log the cause chain, not just the message."],"tags":["http","network","okhttp","put-request"],"backgroundTag":"http-request-failed","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}