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.
if not is_zip_file(zip_file_content):
            raise ClientError(f"Uploaded Lambda code for runtime ({runtime}) is not in Zip format")
        
        if get_unzipped_size(archive_file) >= FUNCTION_MAX_UNZIPPED_SIZE:
            raise Exception(
                f"An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: Unzipped size must be smaller than {FUNCTION_MAX_UNZIPPED_SIZE} bytes"
            )
        unzip(archive_file, lambda_cwd)
    
    if not is_java:
        handler_file = get_handler_file_from_name(handler_name, runtime=runtime)
        main_file = "%s/%s" % (lambda_cwd, handler_file)
        if CHECK_HANDLER_ON_CREATION and not os.path.exists(main_file):
            
            
            
            if not is_local_mount or not use_docker() or config.LAMBDA_REMOTE_DOCKER:
                file_list = run('cd "%s"; du -d 3 .' % lambda_cwd)
                config_debug = 'Config for local mount, docker, remote: "%s", "%s", "%s"' % (
                    is_local_mount,
                    use_docker(),
                    config.LAMBDA_REMOTE_DOCKER,
                )
                LOG.debug("Lambda archive content:\n%s", file_list)
                raise ClientError(
                    error_response(
                        f"Unable to find handler script ({main_file}) in Lambda archive. {config_debug}",
                        400,
                        error_type="ValidationError",
                    )