{"record":{"id":"1c64b62b74606a46","repo":"quickwit-oss/quickwit","slug":"failed-to-list-lambda-versions-for","errorCode":null,"errorMessage":"failed to list Lambda versions for '{}': {}","messagePattern":"failed to list Lambda versions for '(.+?)': (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-lambda-client/src/deploy.rs","lineNumber":213,"sourceCode":"        let mut request = client\n            .list_versions_by_function()\n            .function_name(function_name);\n\n        if let Some(m) = marker {\n            request = request.marker(m);\n        }\n\n        let response = match request.send().await {\n            Ok(resp) => resp,\n            Err(SdkError::ServiceError(err)) if err.err().is_resource_not_found_exception() => {\n                info!(\n                    function_name = %function_name,\n                    \"lambda function does not exist yet\"\n                );\n                return Ok(None);\n            }\n            Err(e) => {\n                return Err(anyhow!(\n                    \"failed to list Lambda versions for '{}': {}\",\n                    function_name,\n                    e\n                ));\n            }\n        };\n\n        for version in response.versions() {\n            if let Some(description) = version.description()\n                && description == target_description\n                && let Some(ver) = version.version()\n                && ver != \"$LATEST\"\n            {\n                return Ok(Some(ver.to_string()));\n            }\n        }\n\n        marker = response.next_marker().map(|s| s.to_string());","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-lambda-client/src/deploy.rs#L195-L231","documentation":"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.","triggerScenarios":"`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`).","commonSituations":"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.","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."],"exampleFix":"// before\nreturn Err(anyhow!(\"failed to list Lambda versions for '{}': {}\", function_name, e));\n// after: retry throttling errors\nif e.as_service_error().map(|se| se.is_too_many_requests_exception()).unwrap_or(false) {\n    return retry_with_backoff(|| find_matching_version(client, function_name, description)).await;\n}\nreturn Err(anyhow!(\"failed to list Lambda versions for '{}': {}\", function_name, e));","handlingStrategy":"try-catch","validationCode":"// pre-flight IAM/credential check\nsts.get_caller_identity().send().await\n    .context(\"AWS credentials invalid before Lambda deploy\")?;","typeGuard":null,"tryCatchPattern":"match deploy_lambda_function(...).await {\n    Err(e) if e.to_string().contains(\"failed to list Lambda versions\") => {\n        if e.to_string().contains(\"TooManyRequests\") {\n            backoff_retry(|| deploy_lambda_function(...)).await?;\n        } else {\n            error!(error = %e, \"Lambda list-versions failed; check IAM/region\");\n            return Err(e);\n        }\n    }\n    other => other?,\n}","preventionTips":["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."],"tags":["aws","lambda","iam","deployment"],"backgroundTag":"api-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"}