{"record":{"id":"7bc8c8aa0ce9ea25","repo":"pentaho/pentaho-kettle","slug":"httppost-error-cannotreadurl","errorCode":null,"errorMessage":"HTTPPOST.Error.CanNotReadURL","messagePattern":"HTTPPOST\\.Error\\.CanNotReadURL","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/httppost/HTTPPOST.java","lineNumber":325,"sourceCode":"          newRow = RowDataUtil.addValueData( newRow, returnFieldsOffset, new Long( responseTime ) );\n          returnFieldsOffset++;\n        }\n        if ( !Utils.isEmpty( meta.getResponseHeaderFieldName() ) ) {\n          newRow = RowDataUtil.addValueData( newRow, returnFieldsOffset, headerString );\n        }\n      } finally {\n        // Release current connection to the connection pool once you are done\n        post.releaseConnection();\n        if ( httpResponse != null ) {\n          httpResponse.close();\n        }\n      }\n      return newRow;\n    } catch ( UnknownHostException uhe ) {\n      throw new KettleException( BaseMessages.getString( PKG,\n        \"HTTPPOST.Error.UnknownHostException\", uhe.getMessage() ) );\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"HTTPPOST.Error.CanNotReadURL\", data.realUrl ), e );\n\n    } finally {\n      if ( fis != null ) {\n        BaseStep.closeQuietly( fis );\n      }\n    }\n  }\n\n  protected int requestStatusCode( HttpResponse httpResponse ) {\n    return httpResponse.getStatusLine().getStatusCode();\n  }\n\n  protected InputStreamReader openStream( String encoding, HttpResponse httpResponse ) throws Exception {\n    if ( !Utils.isEmpty( encoding ) ) {\n      return new InputStreamReader( httpResponse.getEntity().getContent(), encoding );\n    } else {\n      return new InputStreamReader( httpResponse.getEntity().getContent() );\n    }","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/httppost/HTTPPOST.java#L307-L343","documentation":"Generic catch-all in callHTTPPOST: any exception during the HTTP POST (connection refused, timeout, SSL errors, malformed URL, IO errors) is wrapped in a KettleException with 'HTTPPOST.Error.CanNotReadURL' and data.realUrl interpolated. It means the step could not successfully read from the configured URL.","triggerScenarios":"callHTTPPOST throws any Exception other than UnknownHostException while executing the HttpClient request or reading the response for data.realUrl; caught at line 324 and rethrown as KettleException with the CanNotReadURL message.","commonSituations":"Server down or port wrong (connection refused); TLS certificate errors; HTTP 401/403/500 responses treated via protocol exceptions; proxy misconfiguration; request body encoding issues; socket timeouts on large payloads.","solutions":["Check data.realUrl (shown in the message) is reachable: curl -v the same URL from the PDI machine.","Verify the server is running, port open, and firewall/proxy rules allow the request.","Fix SSL issues (import server cert into the JVM truststore) if the error is a certificate problem.","Inspect the wrapped cause (e.getCause()) in the stack trace for the precise failure; adjust timeouts/connection settings accordingly."],"exampleFix":"// before\nString url = \"http://api.example.com:8085/endpoint\"; // wrong port\n// after\nString url = \"http://api.example.com:8080/endpoint\"; // correct, reachable endpoint","handlingStrategy":"try-catch","validationCode":"// Verify the endpoint is reachable before the POST\nHttpURLConnection c = (HttpURLConnection) new URL(realUrl).openConnection();\nc.setConnectTimeout(5000); c.setRequestMethod(\"HEAD\");\nif (c.getResponseCode() >= 400) throw new IllegalStateException(\"Endpoint unhealthy\");","typeGuard":"boolean isUsableUrl(String u) {\n  try { new java.net.URL(u); return true; } catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n  result = callHttpPost(url, params);\n} catch (KettleException ke) {\n  Throwable cause = ke.getCause();\n  log.error(\"POST to \" + realUrl + \" failed: \" + (cause != null ? cause : ke));\n  // classify cause: refused/timeout/SSL and retry or fail over\n}","preventionTips":["Smoke-test endpoints with curl from the runtime host","Set explicit timeouts","Fix TLS truststore issues for HTTPS targets","Configure proxy settings properly"],"tags":["network","http-post","url","connection"],"backgroundTag":"http-request-failed","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}