{"record":{"id":"6979988c74e45cf9","repo":"apache/seatunnel","slug":"httpconnectorerrorcode-request-failed","errorCode":"HttpConnectorErrorCode.REQUEST_FAILED","errorMessage":"http client execute exception, http response status code:[%s], content:[%s]","messagePattern":"http client execute exception, http response status code:\\[(.+?)\\], content:\\[(.+?)\\]","errorType":"error_code","errorClass":"HttpConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-prometheus/src/main/java/org/apache/seatunnel/connectors/seatunnel/prometheus/source/PrometheusSourceReader.java","lineNumber":222,"sourceCode":"                    String lineStr;\n                    while ((lineStr = bufferedReader.readLine()) != null) {\n                        collect(output, lineStr);\n                    }\n                } else {\n                    collect(output, content);\n                }\n            }\n            log.debug(\n                    \"http client execute success request param:[{}], http response status code:[{}], content:[{}]\",\n                    httpParameter.getParams(),\n                    response.getCode(),\n                    response.getContent());\n        } else {\n            String msg =\n                    String.format(\n                            \"http client execute exception, http response status code:[%s], content:[%s]\",\n                            response.getCode(), response.getContent());\n            throw new HttpConnectorException(HttpConnectorErrorCode.REQUEST_FAILED, msg);\n        }\n    }\n}\n","sourceCodeStart":204,"sourceCodeEnd":226,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-prometheus/src/main/java/org/apache/seatunnel/connectors/seatunnel/prometheus/source/PrometheusSourceReader.java#L204-L226","documentation":"The Prometheus source reader's pollAndCollectData executes an HTTP request against the Prometheus server and throws HttpConnectorException(REQUEST_FAILED) whenever the response status code is not a success. It means the HTTP client executed fine but the Prometheus API rejected the request (auth failure, bad query, server error, etc.). The message includes the status code and response body for diagnosis.","triggerScenarios":"PrometheusSourceReader.pollAndCollectData (via internalPollNext) issues an HTTP query; the returned response code is a non-success status (e.g. 400 bad PromQL query, 401/403 bad credentials, 5xx server error).","commonSituations":"Wrong prometheus host/port in URL config; a malformed query producing 400; Prometheus behind a proxy returning 401/403; Prometheus overloaded or restarting returning 503; firewalls/ingress returning 404 for a wrong path prefix.","solutions":["Read the status code and content in the message to identify the cause (4xx = request problem, 5xx = server problem).","Verify the prometheus URL/endpoint and query parameters in the source config are correct and reachable (curl the same URL).","Check credentials/proxy configuration if the status is 401/403.","Retry later or scale Prometheus if the status is 5xx/503 (server-side overload or restart)."],"exampleFix":"// before\nurl = \"http://prometheus-wrong-host:9090/api/v1/query\"\n// after\nurl = \"http://prometheus:9090/api/v1/query\"  // verified with curl returning 200","handlingStrategy":"try-catch","validationCode":"curl -s -o /dev/null -w '%{http_code}' 'http://prometheus:9090/api/v1/query?query=up'  # expect 200 before running the job","typeGuard":null,"tryCatchPattern":"try { reader.pollNext(...) } catch (HttpConnectorException e) { LOG.error(\"Prometheus request failed: {} {}\", e.getMessage(), e); /* inspect status code, backoff-retry or fail job */ }","preventionTips":["Curl the exact query URL before submitting the job","Check Prometheus uptime/auth (4xx vs 5xx) when reading the error content","Add retry with backoff for transient 5xx/503","Keep Prometheus query complexity within server limits to avoid 400/422"],"tags":["http","network","prometheus","connector"],"backgroundTag":"http-error-response","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}