{"record":{"id":"e6ec15eb89ddcc8a","repo":"quickwit-oss/quickwit","slug":"lambda-function-last-update-failed","errorCode":null,"errorMessage":"lambda function '{}' last update failed: {}","messagePattern":"lambda function '(.+?)' last update failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-lambda-client/src/deploy.rs","lineNumber":482,"sourceCode":"        // Check for terminal failure states.\n        if config.state() == Some(&State::Failed) {\n            let reason = config.state_reason().unwrap_or(\"unknown reason\");\n            anyhow::bail!(\n                \"lambda function '{}' is in Failed state: {}\",\n                function_name,\n                reason\n            );\n        }\n\n        let last_update_status: &LastUpdateStatus = config\n            .last_update_status()\n            .unwrap_or(&LastUpdateStatus::Successful);\n\n        if last_update_status == &LastUpdateStatus::Failed {\n            let reason = config\n                .last_update_status_reason()\n                .unwrap_or(\"unknown reason\");\n            anyhow::bail!(\n                \"lambda function '{}' last update failed: {}\",\n                function_name,\n                reason\n            );\n        }\n\n        // Ready = Active state with no update in progress.\n        let is_active = config.state() == Some(&State::Active);\n        if is_active && last_update_status == &LastUpdateStatus::Successful {\n            info!(\n                function_name = %function_name,\n                attempts = attempt + 1,\n                \"lambda function is ready\"\n            );\n            return Ok(());\n        }\n\n        info!(","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-lambda-client/src/deploy.rs#L464-L500","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the reason embedded in the message (Lambda's last_update_status_reason) and fix the underlying cause it names","Verify the deployment package size is within Lambda limits and the zip is valid","Ensure the deploying IAM principal has lambda:UpdateFunctionCode and related permissions","Retry update_function_code after the transient AWS issue resolves"],"exampleFix":"// before\nupdate_function_code(client, \"quickwit-searcher\", &s3_url, 600).await?;\n// after\nlet status = get_function_config(&client, \"quickwit-searcher\").await?.last_update_status;\nif status == Some(\"Failed\".to_string()) {\n    eprintln!(\"previous update failed; retrying deploy\");\n}\nupdate_function_code(client, \"quickwit-searcher\", &s3_url, 600).await?;","handlingStrategy":"try-catch","validationCode":"let cfg = client.get_function(FunctionName::new(name)).send().await?;\nlet status = cfg.configuration().last_update_status();\nif matches!(status, Some(LastUpdateStatus::Failed)) { /* skip or redeploy */ }","typeGuard":"fn is_update_failed(cfg: &FunctionConfiguration) -> bool {\n    matches!(cfg.last_update_status(), Some(LastUpdateStatus::Failed))\n}","tryCatchPattern":"match wait_result {\n    Err(e) if e.to_string().contains(\"last update failed\") => {\n        warn!(\"Lambda update failed: {e}; scheduling redeploy\");\n    }\n    other => other?,\n}","preventionTips":["Check function LastUpdateStatus after each deploy before relying on the new code","Keep deployment packages within Lambda size limits","Use a dedicated IAM role with lambda:UpdateFunctionCode and sufficient permissions"],"tags":["aws","lambda","deployment","async"],"backgroundTag":"http-error-response","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}