com.amazonaws.services.s3.model.AmazonS3Exception

The specified location-constraint is not valid (Service: Amazon S3; Status Code: 400; Error Code: InvalidLocationConstraint; Request ID: 8509B9CACA0AA3D2)


Samebug tips1

Set the S3 bucket to the same region as AmazonS3Client, otherwise it just throws this exception. Check if your bucket name is correct as well.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.


Solutions on the web216

Solution icon of github
via GitHub by edwardotis
, 6 months ago
The specified location-constraint is not valid (Service: Amazon S3; Status Code: 400; Error Code: InvalidLocationConstraint; Request ID: 8509B9CACA0AA3D2)

Solution icon of github
Status Code: 400, AWS Service: Amazon S3, AWS Request ID: ..., AWS Error Code: InvalidLocationConstraint, AWS Error Message: The specified location-constraint is not valid, S3 Extended Request ID: ...

Solution icon of github
The specified location-constraint is not valid (Service: Amazon S3; Status Code: 400; Error Code: InvalidLocationConstraint; Request ID: 85CFF34E01878232), S3 Extended Request ID: Ob5XZJsy8IH7HaZy/moMNAgvaH3ZIrHN9fxyimecIp+xtMZI8nE/sc2YVIoTuf2SuEXyoiQP1wE=\n

Solution icon of github
The specified location-constraint is not valid (Service: Amazon S3; Status Code: 400; Error Code: InvalidLocationConstraint; Request ID: XXXXX), S3 Extended Request ID: XXXXX

Solution icon of github
The operation is not valid for the object's storage class (Service: Amazon S3; Status Code: 403; Error Code: InvalidObjectState; Request ID: 196D6A8F3DD3A2DA), S3 Extended Request ID: qJTKmYTIZ3yTWejeAA2ZJ4Sm2PRulS4BqsIRnGtV76ukrzanq3ngswVLhBKJukTbcf3/ZyGB8Ps=

Solution icon of github
Bad Request (Service: Amazon S3; Status Code: 400; Error Code: 400 Bad Request; Request ID: ....), S3 Extended Request ID: .....=

Solution icon of stackoverflow
via Stack Overflow by James Gilchrist
, 1 year ago
The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ID: 7029FF03D01CFB95)

Solution icon of apache
via spark-user by Dhimant, 1 year ago
The Content-MD5 you specified did not match what we received. (Service: Amazon S3; Status Code: 400; Error Code: BadDigest; Request ID: 5918216A5901FCC8), S3 Extended Request ID: QSxtYln/yXqHYpdr4BWosin/TAFsGlK1FlKfE5PcuJkNrgoblGzTNt74kEhuNcrJCRZ3mXq0oUo=

Solution icon of apache
via spark-user by Dhimant, 1 year ago
The Content-MD5 you specified did not match what we received. (Service: Amazon S3; Status Code: 400; Error Code: BadDigest; Request ID: 5918216A5901FCC8), S3 Extended Request ID: QSxtYln/yXqHYpdr4BWosin/TAFsGlK1FlKfE5PcuJkNrgoblGzTNt74kEhuNcrJCRZ3mXq0oUo=

Stack trace

  • com.amazonaws.services.s3.model.AmazonS3Exception: The specified location-constraint is not valid (Service: Amazon S3; Status Code: 400; Error Code: InvalidLocationConstraint; Request ID: 8509B9CACA0AA3D2) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1586) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1254) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1035) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:747) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:721) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:704) at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:672) at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:654) at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:518) at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4137) at com.amazonaws.services.s3.AmazonS3Client.createBucket(AmazonS3Client.java:998) at com.amazonaws.services.s3.AmazonS3Client.createBucket(AmazonS3Client.java:951) at com.amazonaws.services.s3.AmazonS3$createBucket$1.call(Unknown Source)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

2 times, 4 weeks ago
3 times, 1 month ago
48 times, 2 months ago
Once, 4 months ago
Samebug visitor profile picture
Unknown user
Once, 8 months ago
49 more bugmates