# 发生错误 (InvalidParameterValueException)：调用 UpdateFunctionCode 操作时：解压后的大小必须小于 262144000 字节

- **ID:** `aws/lambda-unzipped-size-exceeded-error`
- **领域:** aws
- **类别:** config_error
- **错误码:** `InvalidParameterValueException`
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

Lambda 函数部署包超过 250 MB 的解压大小限制（262,144,000 字节），通常是由于大型依赖项或捆绑的层。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Lambda API 2015-03-31 | active | — | — |
| AWS CLI 2.15.0 | active | — | — |

## 解决方案

1. ```
   Move large dependencies to Lambda layers. Create a layer with the heavy libraries and attach it to the function. Example: `aws lambda publish-layer-version --layer-name my-layer --zip-file fileb://layer.zip` then `aws lambda update-function-configuration --function-name my-function --layers arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1`
   ```
2. ```
   Use AWS Lambda with container images (up to 10 GB) instead of zip deployment. Build a Docker image with the function code and dependencies, push to ECR, and update the function to use the image.
   ```

## 无效尝试

- **Compressing the deployment package with a higher compression ratio (e.g., zip -9) to reduce the zip file size.** — The limit is on unzipped size, not the zip file size; compression does not reduce unzipped content. (95% 失败率)
- **Removing unnecessary files from the deployment package but keeping large dependencies intact.** — The bulk of the unzipped size often comes from dependencies; cosmetic cleanup may not reduce size enough. (70% 失败率)
