quickwit-oss/quickwit · error · anyhow::Error
failed to list Lambda versions for
Error message
failed to list Lambda versions for '{}': {} What it means
In the Lambda auto-deployment flow, `find_matching_version` calls the AWS `list_versions_by_function` API to find a published version whose description matches. If the API call fails with anything other than ResourceNotFound (which is handled as 'function does not exist yet'), the error is wrapped in this message and propagation stops. It indicates an AWS-side or permissions problem rather than a missing function.
Solutions
- Read the wrapped AWS SDK error for the exact cause (auth, throttling, permission).
- Verify IAM permissions include `lambda:ListVersionsByFunction` for the function.
- Check AWS credentials and region configuration (env vars, profile) are valid and match the function's region.
- Retry on transient/throttling errors (consider exponential backoff) before redeploying.
Example fix
// before
return Err(anyhow!("failed to list Lambda versions for '{}': {}", function_name, e));
// after: retry throttling errors
if e.as_service_error().map(|se| se.is_too_many_requests_exception()).unwrap_or(false) {
return retry_with_backoff(|| find_matching_version(client, function_name, description)).await;
}
return Err(anyhow!("failed to list Lambda versions for '{}': {}", function_name, e)); Defensive patterns
Strategy: try-catch
Validate before calling
// pre-flight IAM/credential check
sts.get_caller_identity().send().await
.context("AWS credentials invalid before Lambda deploy")?; Try / catch
match deploy_lambda_function(...).await {
Err(e) if e.to_string().contains("failed to list Lambda versions") => {
if e.to_string().contains("TooManyRequests") {
backoff_retry(|| deploy_lambda_function(...)).await?;
} else {
error!(error = %e, "Lambda list-versions failed; check IAM/region");
return Err(e);
}
}
other => other?,
} Prevention
- Grant lambda:ListVersionsByFunction (and lambda:PublishVersion) to the deploy role.
- Pin the AWS region to the function's region in the deploy environment.
- Add throttling-aware retries to the deploy pipeline.
When it happens
Trigger: `list_versions_by_function` returns an unexpected error — invalid credentials, lack of `lambda:ListVersionsByFunction` permission, throttling, region misconfiguration, or a transient AWS outage — inside `find_matching_version` (called by `find_or_deploy_version`).
Common situations: IAM role missing lambda:ListVersionsByFunction; AWS credentials expired or not configured; wrong region configured for the function; AWS Lambda throttling (rate limit) during mass deployments.
Related errors
- failed to create Lambda function
- created function has no version number
- lambda function ' ' did not become ready within seconds
- lambda function ' ' last update failed
- lambda invocation failed
AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08).
Data as JSON: /api/errors/1c64b62b74606a46.
Report an issue: GitHub.
Appendix: source
Thrown at quickwit/quickwit-lambda-client/src/deploy.rs:213
let mut request = client
.list_versions_by_function()
.function_name(function_name);
if let Some(m) = marker {
request = request.marker(m);
}
let response = match request.send().await {
Ok(resp) => resp,
Err(SdkError::ServiceError(err)) if err.err().is_resource_not_found_exception() => {
info!(
function_name = %function_name,
"lambda function does not exist yet"
);
return Ok(None);
}
Err(e) => {
return Err(anyhow!(
"failed to list Lambda versions for '{}': {}",
function_name,
e
));
}
};
for version in response.versions() {
if let Some(description) = version.description()
&& description == target_description
&& let Some(ver) = version.version()
&& ver != "$LATEST"
{
return Ok(Some(ver.to_string()));
}
}
marker = response.next_marker().map(|s| s.to_string());View on GitHub (pinned to a39730c5cd)