While a lambda is still processing (archive unpacking etc), the lambda state should be set to "Pending" (currently "Active") and invocations to that lambda should fail (currently, it can end up in a inconsistent state in this case, like lambdas being executed without layers).

Lambda state should reflect the current internal state, and invocations should fail if not active.
return execute
    raise ClientError(
        error_response(
            "Unable to extract Java Lambda handler - file is not a valid zip/jar file (%s, %s bytes)"
            % (main_file, len(zip_file_content or "")),
            400,
            error_type="ValidationError",
        )
    )
def set_archive_code(code: Dict, lambda_name: str, zip_file_content: bytes = None) -> Optional[str]:
    region = LambdaRegion.get()
    
    lambda_arn = func_arn(lambda_name)
    lambda_details = region.lambdas[lambda_arn]
    is_local_mount = code.get("S3Bucket") == config.BUCKET_MARKER_LOCAL
    if is_local_mount and config.LAMBDA_REMOTE_DOCKER:
        msg = 'Please note that Lambda mounts (bucket name "%s") cannot be used with LAMBDA_REMOTE_DOCKER=1'
        raise Exception(msg % config.BUCKET_MARKER_LOCAL)
    
    LAMBDA_EXECUTOR.cleanup(lambda_arn)
    if is_local_mount:
        
        
        
        
        lambda_details.cwd = code.get("S3Key")
        return code["S3Key"]
    
    zip_file_content = zip_file_content or get_zip_bytes(code)
    if not zip_file_content: