java - not - there is a conflicting operation in progress for the resource named lex




AWS Error Message: A conflicting conditional operation is currently in progress against this resource (4)

Simple and straightforward: Change the new bucket name or wait 1 hour.

I'm getting this error intermittently.

I have a program that uses the java aws sdk and loads over the 10s of thousands of small files to s3. I see this error intermittently.

Could not find any helpful answer after doing a quick search on the internet.

Note the calling program is single threaded. The underlying aws java sdk does seem to use worker threads.

Status Code: 409, AWS Service: Amazon S3, AWS Request ID: 75E16E8DE2193CA6, AWS Error Code: OperationAborted, AWS Error Message: A conflicting conditional operation is currently in progress against this resource. Please try again., S3 Extended Request ID: 0uquw2YEoFamLldm+c/p412Lzd8jHJGFBDz3h7wN+/4I0f6hnGLkPMe+5LZazKnZ
    at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:552)
    at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:289)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:170)
    at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:2648)
    at com.amazonaws.services.s3.AmazonS3Client.createBucket(AmazonS3Client.java:578)
    at com.amazonaws.services.s3.AmazonS3Client.createBucket(AmazonS3Client.java:503)

For all others who stumble upon this thread from google, as 1st result in search for this error message:

If you deleted bucket, to recreate in new region, do not wait "manually" until this background sync will be complete, instead put a small bash script to run and retry your needed bucket creation every 5 seconds or so.

Example:

#!/bin/bash 
RESULT=2 
until [  $RESULT -eq 0 ]; do
    aws s3 mb s3://your.bucket.name --region us-west-2
    RESULT=$?
    sleep 5 
done 
echo "Bucket created!"

it will retry the "create bucket" operation for you, every few seconds (depend on 'sleep' ) and as soon as it's possible - will create it for you, so no one can steal your bucket name by mistake :)

hope it helps :)


The request in your example is to create a bucket. If you are trying to create too many buckets or replace buckets, it is not healthy.

Note that you have a limit of 100 buckets for an account (see here). EDIT: Now this limit is a "soft limit" and you can increase it if needed.

Also note that a creation of a bucket takes time and:

...it is not appropriate to make bucket create or delete calls on the high availability code path of your application...

It is better to create your buckets once and then, you can put as many objects that you like in your existing buckets (or even a single one).

Anyway, when working with a system that is bound to fail any now and then, you should be able to handle errors and slow down your process when receiving such an error. See more details in AWS Docs.


This error usually occurs when a Bucket is deleted and a new bucket is created in the same name as the old bucket.

I believe we would need to wait for certain amount of time until we can create a new bucket in the same name.