Amazon S3 exception: "The specified key does not exist"

user4592690 picture user4592690 · Feb 22, 2015 · Viewed 142.3k times · Source

I am using the AmazonS3Client in an Android app using a getObject request to download an image from my Amazon S3 bucket.

Currently, I am getting this exception:

com.amazonaws.services.s3.model.AmazonS3Exception: 
The specified key does not exist.
 (Service: Amazon S3; Status Code: 404; Error Code: NoSuchKey;

Even though I am able to see the object with the specified key in my S3 bucket.

Answer

Fahim picture Fahim · Feb 22, 2015

Well this error is actually rather straight forward.  it simply means that your file does not exist up within the S3 bucket.  Several things could be wrong:

  1. You could be trying to reference the wrong file.  Double check the path that you tried to retrieve.

  2. Whenever the file was uploaded it must have failed.  Check the logs for your S3Sync process to see if you can find any relevant output

Source