quickwit-oss/quickwit · error

lambda function ' ' is in Failed state

Error message

lambda function '{}' is in Failed state: {}

What it means

wait_for_function_ready polls the Lambda function configuration until the function is Active. If the poll observes State == Failed, it bails with the function name and AWS-provided state reason, since a Failed Lambda state is terminal and will never become ready.

Solutions

  1. Read the state_reason in the error message and fix the underlying deployment issue (package, image, role, or VPC config).
  2. Retry the update with a valid function code/artifact (check the artifact URL and SHA256 configured in build.rs).
  3. Delete and recreate the function if it is stuck in Failed state after repeated update attempts.
Defensive patterns

Strategy: try-catch

Try / catch

match wait_for_function_ready(&lambda, "my-function", timeout).await {
    Ok(_) => { /* function active */ }
    Err(e) if e.to_string().contains("is in Failed state") => {
        // terminal failure: read the reason, fix deployment inputs, do not keep polling
    }
    Err(e) => { /* transient: may retry within timeout */ }
}

Prevention

When it happens

Trigger: Polling during update_function_code (or directly) when GetFunctionConfiguration returns State=Failed with a state_reason (e.g., failed deployment, image pull error, invalid package/permissions).

Common situations: Bad Lambda deployment package or container image; insufficient Lambda execution role permissions; VPC/network misconfiguration causing the function create/update to fail; stale artifact URL/SHA in the lambda client build script.

Related errors


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

Appendix: source

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

    for attempt in 0..MAX_WAIT_ATTEMPTS {
        interval.tick().await;

        let response = client
            .get_function()
            .function_name(function_name)
            .send()
            .await
            .context("failed to get function status")?;

        let Some(config) = response.configuration() else {
            continue;
        };

        // 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

View on GitHub (pinned to a39730c5cd)