AWS S3: NoSuchKey / NoSuchBucket — The specified key/bucket does not exist
S3 found no object at that key (or no bucket with that name in the region/account you’re calling).
Meaning
Keys are exact strings — case, leading slashes and URL encoding all matter. Note: without s3:ListBucket permission, S3 returns AccessDenied (403) instead of NoSuchKey for missing objects.
Common causes
- Wrong key: leading
/, case, or missing folder prefix - URL-encoded characters (spaces →
+/%20) not decoded - Object not uploaded yet / deleted / lifecycle-expired
- Bucket name typo or wrong account/region
- Static website hosting without index document
⚡ Quick fix
- List what exists:
aws s3 ls s3://bucket/prefix/ - Strip leading slashes and decode keys from events (
decodeURIComponent(key.replace(/\+/g, " "))) - Verify bucket name and account
Detailed fix by platform
AWS
- S3 event keys are URL-encoded:javascript
export const handler = async (event) => { const raw = event.Records[0].s3.object.key; const key = decodeURIComponent(raw.replace(/\+/g, ' ')); // "my+file.pdf" → "my file.pdf" };
How to diagnose
- Key — Exact key string (print it)
- Listing — What does
aws s3 lsshow under the prefix? - Bucket — Right bucket/account/region?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026