vectordotdev/vector · error
should not fail to build request
Error message
should not fail to build request
What it means
The validation harness's HTTP client input driver builds an HTTP request whose body is the encoded test event buffer and `expect`s construction to succeed. Building a `Request` with a fixed-method, fixed-URI and a bytes body is normally infallible; a panic means the request builder was misconfigured (e.g. invalid URI/headers).
Solutions
- Check the test-case's `http` input client address/URI configuration for validity (scheme, host, port)
- Verify all configured headers are valid ASCII HTTP header values
- Ensure the listen address resolves (no typos, correct port)
- Update Vector if the failure occurs with a default test case
Example fix
// before address = "localhost:8126" // after (include scheme) address = "http://localhost:8126"
Defensive patterns
Strategy: validation
Validate before calling
// validate the request URI before running the test case
const u = new URL(testCase.address); // throws early on invalid URI
if (!/^https?:$/.test(u.protocol)) throw new Error("must be http(s)"); Prevention
- Include scheme in configured addresses (http://host:port)
- Keep headers ASCII and well-formed
- Confirm the target address/port is free and resolvable
When it happens
Trigger: `spawn_input_http_client` (called via `spawn_as_input`) building the request from the test-case's listen address, method and headers; `request_builder.body(...)` returning Err — typically from an invalid URI scheme/authority or unsupported header value.
Common situations: Test-case config with an invalid address/URI for the input HTTP client; non-ASCII or malformed header values configured in the test case; port collisions producing an unusable address.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- Failed to bind to listen address.
- not implemented
- should not fail to convert method to method filter
- should not fail to send output event
- a valid HTTP/1 URI is valid as an HTTP URI
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/b8fcfd9678a5e749.
Report an issue: GitHub.
Appendix: source
Thrown at src/components/validation/resources/http.rs:266
buffer.put_u8(b']');
// in this edge case we have removed the trailing comma (one byte) and added
// opening and closing braces (2 bytes) for a net add of one byte.
let mut runner_metrics = runner_metrics.lock().await;
runner_metrics.sent_bytes_total += 1;
}
let mut request_builder = Request::builder()
.uri(request_uri.clone())
.method(request_method.clone());
for (key, value) in &headers {
request_builder = request_builder.header(key, value);
}
let request = request_builder
.body(buffer.freeze().into())
.expect("should not fail to build request");
match client.request(request).await {
Ok(_response) => {
// TODO: Emit metric that tracks a successful response from the HTTP server.
debug!("Got response from server.");
}
Err(e) => {
// TODO: Emit metric that tracks a failed response from the HTTP server.
error!("Failed to send request: {e}");
}
}
}
// Mark ourselves as completed now that we've sent all inputs to the source.
completed.mark_as_done();
info!("HTTP client external input resource completed.");
});View on GitHub (pinned to bdb87aeaa4)