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 tips

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.


6 months ago
Expert tip

Solutions on the web

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

Solution icon of duraspace
via Sakai JIRA by David Chandek-Stark, 1 month ago
The Content-MD5 you specified did not match what we received. (Service: Amazon S3; Status Code: 400; Error Code: BadDigest; Request ID: E0D89BF1B288C2DD)

Solution icon of github
You did not provide the number of bytes specified by the Content-Length HTTP header. (Service: Amazon S3; Status Code: 400; Error Code: IncompleteBody; Request ID: 3L137), S3 Extended Request ID: 3L137

Solution icon of github
The specified bucket does not exist (Service: Amazon S3; Status Code: 404; Error Code: NoSuchBucket; Request ID: C7B550EE3D463998)

Solution icon of github
The specified bucket does not exist (Service: Amazon S3; Status Code: 404; Error Code: NoSuchBucket; Request ID: null) , S3 Extended Request ID: null

Solution icon of github
The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ID: 25A928491624EB60), S3 Extended Request ID: DM7fWaJ+9bKZcoXEBrjDDBS8nwwgxQwoCek7HdEtky+y1QQxr0VnfF/B1HnZxz48gl6fPkY1h60=

Solution icon of stackoverflow
The specified key does not exist. (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey; Request ID: OGHA849FC554576862 , S3 Extended Request ID: usU4PsytlZKT//3XxeQrhdjkndxjknwerfhjneneeOvla4sO97aWNsAIpO41/MRcwMWmVI651styse4oMZaL7yR9Q7vE=

Solution icon of github
via GitHub by Nazariy995
, 7 months ago
The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'us-east-2' (Service: Amazon S3; Status Code: 400; Error Code: AuthorizationHeaderMalformed; Request ID: 8E337C89F26EED0A)

Solution icon of stackoverflow
via Stack Overflow by John Jai
, 1 month ago
The specified method is not allowed against this resource. (Service: Amazon S3; Status Code: 405; Error Code: MethodNotAllowed; Request ID: 1D12DDA5F0493282), S3 Extended Request ID: jTNnAl8ifgsUlPMV0GEHAEVBtWwjTprEJy45C9BMJ5kTk/Qn8Pne8/ZM/tH27ZoeUtHrd1NeuyQ=

Solution icon of stackoverflow
null (Service: Amazon S3; Status Code: 400; Error Code: InvalidArgument; Request ID: null; S3 Extended Request ID: null), S3 Extended Request ID: null

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, 3 months ago
3 times, 4 months ago
48 times, 4 months ago
Once, 7 months ago
Samebug visitor profile picture
Unknown user
Once, 10 months ago
49 more bugmates