{"record":{"id":"e01367aa8e3e7400","repo":"risingwavelabs/risingwave","slug":"http-sink-received-non-success-response","errorCode":null,"errorMessage":"HTTP sink received non-success response: {} {}","messagePattern":"HTTP sink received non-success response: (.+?) (.+?)","errorType":"http","errorClass":"SinkError::Http","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/http.rs","lineNumber":469,"sourceCode":"                continue;\n            };\n            let Some(url) = self.extract_url(&row)? else {\n                continue;\n            };\n\n            let resp = self\n                .client\n                .request(self.method.clone(), url)\n                .body(payload)\n                .send()\n                .await\n                .context(\"HTTP request failed\")\n                .map_err(SinkError::Http)?;\n\n            if !resp.status().is_success() {\n                let status = resp.status();\n                let body = resp.text().await.unwrap_or_default();\n                return Err(SinkError::Http(anyhow!(\n                    \"HTTP sink received non-success response: {} {}\",\n                    status,\n                    body\n                )));\n            }\n        }\n\n        Ok(())\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use risingwave_common::types::{JsonbVal, Scalar};\n\n    use super::*;\n\n    #[test]","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/http.rs#L451-L487","documentation":"After each HTTP request, the sink checks the response status. If the HTTP server returned a non-2xx status, the sink fails the write with this error, including the status code and the response body, so the user can diagnose why the remote endpoint rejected the request.","triggerScenarios":"The remote HTTP endpoint responds with 4xx/5xx during `write_chunk` — e.g. 400 bad payload, 401/403 auth failure, 404 wrong path, 429 rate limiting, 5xx server errors.","commonSituations":"Missing or expired API key on the remote service; wrong URL path; payload not matching the endpoint's expected schema; endpoint down or rate limited; proxy/firewall returning error pages.","solutions":["Read the status and body in the error to identify the cause (401/403 -> fix auth, 404 -> fix url, 400 -> fix payload format)","Verify the `url` option/column points to the correct endpoint path","Check credentials/API keys required by the remote endpoint and any configured headers","Retry after the remote service recovers (5xx/429 are transient)","Validate payload format against the API contract (JSON vs plain text)"],"exampleFix":"// before\nCREATE SINK s FROM t WITH (connector='http', url='https://api.example.com/v1/wrongpath');\n// after\nCREATE SINK s FROM t WITH (connector='http', url='https://api.example.com/v1/ingest',\n  headers='Authorization: Bearer <token>');","handlingStrategy":"try-catch","validationCode":"// pre-flight check before configuring the sink\ncurl -s -o /dev/null -w '%{http_code}' -X POST \"$URL\" -H \"$AUTH\" -d '{}' # expect 2xx/4xx-with-clear-reason, not 5xx","typeGuard":null,"tryCatchPattern":"match res {\n    Err(e) if e.to_string().contains(\"non-success response\") => {\n        let (status, body) = parse_status_and_body(&e);\n        if status.is_server_error() || status == 429 {\n            // retry with backoff\n        } else {\n            // fix auth/url/payload before retrying\n        }\n    }\n    other => other?,\n}","preventionTips":["Test the endpoint with curl before creating the sink","Set auth headers correctly in the sink options","Monitor for 429/5xx and use retry/backoff semantics where available","Keep payload format aligned with the API contract"],"tags":["sink","http","network","http-error","risingwave"],"backgroundTag":"http-error-response","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}