quickwit-oss/quickwit · error

lambda function '{}' last update failed: {}

Error message

lambda function '{}' last update failed: {}

What it means

Thrown by wait_for_function_ready in the Lambda client when AWS reports the function's LastUpdateStatus is Failed. The client polls the function configuration after a code update and refuses to proceed when Lambda signals the update did not apply, surfacing Lambda's own last_update_status_reason.

Source

Thrown at quickwit/quickwit-lambda-client/src/deploy.rs:482

        // Check for terminal failure states.
        if config.state() == Some(&State::Failed) {
            let reason = config.state_reason().unwrap_or("unknown reason");
            anyhow::bail!(
                "lambda function '{}' is in Failed state: {}",
                function_name,
                reason
            );
        }

        let last_update_status: &LastUpdateStatus = config
            .last_update_status()
            .unwrap_or(&LastUpdateStatus::Successful);

        if last_update_status == &LastUpdateStatus::Failed {
            let reason = config
                .last_update_status_reason()
                .unwrap_or("unknown reason");
            anyhow::bail!(
                "lambda function '{}' last update failed: {}",
                function_name,
                reason
            );
        }

        // Ready = Active state with no update in progress.
        let is_active = config.state() == Some(&State::Active);
        if is_active && last_update_status == &LastUpdateStatus::Successful {
            info!(
                function_name = %function_name,
                attempts = attempt + 1,
                "lambda function is ready"
            );
            return Ok(());
        }

        info!(

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Read the reason embedded in the message (Lambda's last_update_status_reason) and fix the underlying cause it names
  2. Verify the deployment package size is within Lambda limits and the zip is valid
  3. Ensure the deploying IAM principal has lambda:UpdateFunctionCode and related permissions
  4. Retry update_function_code after the transient AWS issue resolves

Example fix

// before
update_function_code(client, "quickwit-searcher", &s3_url, 600).await?;
// after
let status = get_function_config(&client, "quickwit-searcher").await?.last_update_status;
if status == Some("Failed".to_string()) {
    eprintln!("previous update failed; retrying deploy");
}
update_function_code(client, "quickwit-searcher", &s3_url, 600).await?;
Defensive patterns

Strategy: try-catch

Validate before calling

let cfg = client.get_function(FunctionName::new(name)).send().await?;
let status = cfg.configuration().last_update_status();
if matches!(status, Some(LastUpdateStatus::Failed)) { /* skip or redeploy */ }

Type guard

fn is_update_failed(cfg: &FunctionConfiguration) -> bool {
    matches!(cfg.last_update_status(), Some(LastUpdateStatus::Failed))
}

Try / catch

match wait_result {
    Err(e) if e.to_string().contains("last update failed") => {
        warn!("Lambda update failed: {e}; scheduling redeploy");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling update_function_code (or waiting on readiness) when the Lambda publish returns LastUpdateStatus=Failed, e.g. due to a deployment package that is too large, a permission error during publish, or Lambda internal update errors.

Common situations: Deploying a searcher lambda whose zip exceeds Lambda's package limit; transient AWS service errors during a deploy; IAM role missing permissions for the update; concurrent updates racing on the same function.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/e6ec15eb89ddcc8a. Report an issue: GitHub.