vectordotdev/vector · error
error creating request
Error message
error creating request
What it means
The aws_ecs_metrics source builds a GET request each polling interval and unwraps the builder result with expect("error creating request"). The builder fails only when request components (the configured URL) are invalid, so a bad metrics/telemetry endpoint URL panics the polling task instead of surfacing a config error.
Solutions
- Set the ECS endpoint URL correctly (valid absolute http URI, e.g. from ECS_CONTAINER_METADATA_URI).
- Validate/parse the URL at source build time and fail config validation instead of panicking per interval.
- Ensure environment substitution did not leave the endpoint empty or truncated.
Example fix
// before
.expect("error creating request");
// after
let request = Request::get(&url)
.body(Body::empty())
.map_err(|_| ())?; // skip this interval; log the invalid URL Defensive patterns
Strategy: validation
Validate before calling
let parsed = url::Url::parse(&endpoint).map_err(|e| format!("invalid ECS metrics endpoint: {e}"))?; Try / catch
let request = Request::get(&url).body(Body::empty()).map_err(|e| { error!(%e, "invalid ECS metrics URL"); return Err(()); })?; Prevention
- Confirm ECS_CONTAINER_METADATA_URI (or equivalent) is set and well-formed before running the source.
- Validate the URL at build time rather than inside the polling loop.
- Log and skip invalid intervals instead of panicking.
When it happens
Trigger: Request::get(&url).body(Body::empty()) returning Err because the ECS metrics endpoint URL from configuration/environment (ECS_CONTAINER_METADATA_URI style) is not a valid URI.
Common situations: Running the source outside ECS with an unset or garbled metadata URI env var; misconfigured endpoint string with unencoded characters or empty value.
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
- a valid HTTP/1 URI is valid as an HTTP URI
- a validated HTTP endpoint is a valid `http 1` URI
- error creating request
- invalid parts
- backoff never ends
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/5c54b1371c35ff56.
Report an issue: GitHub.
Appendix: source
Thrown at src/sources/aws_ecs_metrics/mod.rs:192
fn can_acknowledge(&self) -> bool {
false
}
}
async fn aws_ecs_metrics(
http_client: HttpClient,
url: String,
interval: Duration,
namespace: Option<String>,
mut out: SourceSender,
shutdown: ShutdownSignal,
) -> Result<(), ()> {
let mut interval = IntervalStream::new(time::interval(interval)).take_until(shutdown);
let bytes_received = register!(BytesReceived::from(Protocol::HTTP));
while interval.next().await.is_some() {
let request = Request::get(&url)
.body(Body::empty())
.expect("error creating request");
let uri = request.uri().clone();
match http_client.send(request).await {
Ok(response) if response.status() == hyper::StatusCode::OK => {
match http_body::Body::collect(response.into_body())
.await
.map(Collected::to_bytes)
{
Ok(body) => {
bytes_received.emit(ByteSize(body.len()));
match parser::parse(body.as_ref(), namespace.clone()) {
Ok(metrics) => {
let count = metrics.len();
emit!(AwsEcsMetricsEventsReceived {
byte_size: metrics.estimated_json_encoded_size_of(),
count,
endpoint: uri.path(),View on GitHub (pinned to bdb87aeaa4)