Error codes and troubleshooting
When a request fails, S4 returns an HTTP status code and an XML error message. Look up the meaning and the fix by Code in the tables below.
Error response
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied.</Message>
<RequestId>1795515998868996309</RequestId>
<Key>x.txt</Key>
<HostID>Ed6IhpST4VqRFmgv3eFI...</HostID>
</Error>| Field | Description |
|---|---|
Code | The error code. Programs should decide based on it and the HTTP status code |
Message | An English description that may change; do not use it for decisions |
RequestId | The request ID, identical to the x-amz-request-id response header |
Key | The requested object key |
HostID | Used by support to locate the request; include it when you contact us |
- Every response (including successful ones) carries
x-amz-request-id. When you contact support, provide it along with the request time and the full error message. - HEAD requests have no response body, so only the status code is available.
- The 304 and 412 responses to conditional reads have no response body.
- When accessed as a website through a bound domain or a CDN, 403 and 404 return an HTML page instead of XML.
Authentication and signatures
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 403 | InvalidAccessKeyId | The AccessKey does not exist | Check for typos, check whether it was deleted, and check that the endpoint is https://s3.bitiful.net |
| 403 | SignatureDoesNotMatch | The signature does not match | See the checklist |
| 403 | RequestTimeTooSkewed | The request time is more than 15 minutes earlier than the server time | Correct the local clock |
| 403 | AccessDenied(Request is not valid yet) | The request time is more than 15 minutes later than the server time | Correct the local clock |
| 403 | AccessDenied(Request has expired) | The presigned link has expired | Generate a new one |
| 403 | AccessDenied(There were headers present in the request which were not signed) | The request carries an unsigned x-amz-* header | Add the header to the signature, or remove it |
| 400 | AuthorizationQueryParametersError | A presigned parameter is missing or malformed, or the validity period exceeds 604800 seconds | Fix the parameters as described |
| 400 | MissingFields、InvalidArgument | The Authorization header is malformed | Sign with an SDK, or check the format of your hand-written signature |
| 400 | InvalidRequest | The signing method is not supported, or the service name in the credential scope is not s3 | Use V4 signing |
| 400 | XAmzContentSHA256Mismatch | The SHA-256 of the content does not match x-amz-content-sha256, or its value is inconsistent | Sign with an SDK, or check the digest in a hand-written signature; don't change the content after signing |
Permissions and access restrictions
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 403 | AccessDenied | No permission, or denied by an access control list | See the checklist |
| 403 | BucketHasBeenBanned | The bucket is suspended. The cause may be an overdue balance or a ban for violations | First check your account balance. If the balance is overdue, top up; service resumes automatically once the balance is positive. If the balance is not overdue, contact support |
| 403 | OriginalFileProtected | Original file protection is on, so anonymous access to the original file is denied | Access through a Style, or use a presigned link. See Original file protection |
| 403 | FileTypeForbidden | .apk and .ipa files cannot be downloaded directly from S4 | Use a CDN |
| 403 | ReachTheMaxRequests | The presigned link exceeded its x-bitiful-max-requests count | Generate a new link. See Presigned URLs |
Buckets
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 404 | NoSuchBucket | The bucket does not exist | Check the bucket name. Without permission, a nonexistent bucket also returns 403 |
| 409 | BucketAlreadyExists | The bucket name is already used by someone else | Pick another name; bucket names are globally unique |
| 409 | BucketAlreadyOwnedByYou | The bucket already belongs to you | You can use it directly |
| 409 | BadBucketName、BucketNameTooShort、BucketNameTooLong | The bucket name is invalid | See the naming rules |
| 400 | TooManyBuckets | The number of buckets exceeds the quota | See Limits |
| 409 | BucketNotEmpty | The bucket is not empty | Empty it before deleting |
| 400 | CORSTooManyRules、CORSRuleTooManyDomains、CORSNoRule、CORSDuplicateID | The CORS rules are invalid | Up to 10 rules, each with up to 10 origins; at least one rule; rule IDs must be unique |
Objects and uploads
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 404 | NoSuchKey | The object does not exist, or the target of a conditional write does not exist | Check the case, directory, and URL encoding of the object key |
| 400 | KeyTooLongError | The object key exceeds 1024 bytes | Shorten the key. Non-ASCII characters count as their UTF-8 byte length |
| 400 | Invalid URI | The object key contains non-printable characters, or has a path segment that is entirely . or .. | Rename it. See Object key rules |
| 400 | InvalidDigest | The Content-MD5 format is invalid. It is also returned when Cache-Control cannot be parsed | Check these two headers |
| 400 | BadDigest | The content does not match Content-MD5 or the checksum | The network or your program altered the content; upload again |
| 400 | MalformedDate | The date format is invalid, for example in the Expires header | Use the HTTP date format |
| 400 | EntityTooLarge | The size limit is exceeded | See Limits |
| 400 | EntityTooSmall | A part is smaller than 5 MiB (except the last part), or a form upload is smaller than the required size | Increase the part size |
| 404 | NoSuchUpload | The multipart upload does not exist, has completed or been aborted, or uploadId does not match the object key | Create a new multipart upload |
| 400 | InvalidPart | A part does not exist, an ETag does not match, or all parts are empty | Check with ListParts, then retry |
| 400 | InvalidArgument | An invalid argument. Common causes: the copy source does not exist, a batch delete has more than 1000 keys, a part number is out of range, or a media processing parameter is invalid | Read the Message |
| 400 | MalformedXML | The request body XML is invalid | Check the XML |
| 400 | InvalidTag | A tag is invalid | Up to 10 tags; keys up to 128, values up to 256 |
| 400 | InvalidCopyDest、InvalidCopyType | Copying onto itself without changing metadata, or the source or destination is a directory | Change the parameters |
| 400 | InvalidMoveDest、InvalidMoveType | The move destination is invalid, or the source or destination is a directory | Change the parameters |
| 409 | ExistingObjectIsFile | A file with the same name already exists at the destination or in a parent path | A file and a directory cannot share a name |
| 409 | ExistingObjectIsDirectory | A directory with the same name already exists at the destination | A file and a directory cannot share a name |
| 409 | OperationAborted | Conflicts with a concurrent write | Wait and retry |
| 412 | PreconditionFailed | The condition does not hold | See Conditional requests |
| 400 | PostPolicyInvalidKeyName、MalformedPOSTRequest | The policy or form format of a form upload is invalid | Check the form fields |
| 499 | ClientCanceled | The client disconnected or stopped sending | Check client timeouts and the network |
Media processing and mirror back-to-origin
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 403 | TooLargeForCoreIX | The original file exceeds 200 MiB (video and frame extraction excepted) | Compress the original file first |
| 415 | UnsupportedMediaType、UnSupportedType | The file type cannot be processed, or processing was requested on a directory | See Supported formats |
| 400 | InvalidArgument | A processing parameter is invalid | Read the Message and check the CoreIX parameters |
| 424 | MirrorFailed | The mirror origin did not return 200, 206, or 404 | Check the origin and the mirror back-to-origin settings |
| 202 | MirrorFetching | The object is being fetched from the origin and is temporarily unavailable | Retry later |
Rate limiting and server errors
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 429 | TooManyRequest | Too many concurrent requests | Lower the concurrency and retry with exponential backoff |
| 500 | InternalError | Server error | Retry with backoff. For write requests, confirm the result before retrying |
| 502 | BadGateway | The backend is temporarily unreachable | Retry with backoff |
| 503 | ServiceUnavailable | The service is temporarily unavailable | Retry with backoff |
| 501 | NotImplemented | The feature is not implemented, for example a delimiter other than / in a listing | See S3 API compatibility |
| 405 | MethodNotAllowed | The request method does not match the path | Check the method and the URL |
S4 rate limiting returns 429 TooManyRequest, not AWS's 503 SlowDown. Some SDKs do not retry this error code automatically, so handle 429 in your program.
SignatureDoesNotMatch checklist
Check in order:
- Keys. Check whether the SecretKey has extra spaces or line breaks copied with it, and whether it pairs with the AccessKey.
- Method. The method of a presigned link must match the request method. A link generated for GET works only for GET and HEAD.
- The URL was modified. You cannot add or remove parameters after signing, including tracking parameters, CoreIX parameters, and
x-amz-limit-rate. - The URL was escaped. When a link is written into HTML or logs,
&may become&and%2Fmay become%252F. - Content-Type. If
content-typewas signed when the upload link was generated, the upload must match it exactly. Browsers may addcharsetautomatically. - Host. A reverse proxy must not rewrite the Host header. Have the client access the bucket domain directly.
- Headers rewritten by a proxy. If a proxy modifies a header that is part of the signature (for example
Accept-Encoding), the signature becomes invalid. - Object key encoding. When signing by hand, encode spaces as
%20instead of+, and encode Chinese characters as UTF-8. - Signature version. Use V4, set the Region to
cn-east-1, and uses3as the service name. - SDK too old. Upgrade to a recent version, or follow the configuration in the examples for each language.
AccessDenied checklist
Signed requests
- Check whether the sub-user has the matching permission on this bucket or directory. A new sub-user has no permissions by default; see Sub-user permissions.
- Check whether the directory grant covers this object key.
- Listing requires list permission, and reading or writing files requires read or write permission; they are separate.
- Copying requires read permission on the source and write permission on the destination. Moving also requires write permission on the source.
- Writes with conditions such as
If-Matchalso require read permission. - You cannot create or delete buckets with a sub-user AccessKey.
- The object that the watermark image
markpoints to also needs read permission.
Anonymous access
- Check whether the bucket or directory is set to public read.
- Check whether the request was denied by the IP, Referer, or Headers lists in access control. A list denial has no dedicated error code; it is also
AccessDenied. - Anonymous access to a nonexistent object also returns 403 when there is no public read; it does not return 404.
Retry recommendations
| Can retry | Do not retry as is |
|---|---|
429, 500, 502, 503, and 409 OperationAborted | Other 4XX |
| Network timeout, connection reset | 412 |
Retry with exponential backoff plus random jitter, for example 0.5 seconds, 1 second, 2 seconds, up to 5 times. Mainstream SDKs have this built in, so you usually only need to add 429.