opencontainers/distribution-spec

Question regarding error codes for distribution spec

git-hyagi opened this issue · 3 comments

Hi!

In the "Pushing Manifests" section, it mentions that the registry should respond with a code "413 Payload Too Large":

"A registry SHOULD enforce some limit on the maximum manifest size that it can accept. A registry that enforces this limit SHOULD respond to a request to push a manifest over this limit with a response code 413 Payload Too Large."

However, according to the definition in the 'Error Codes' section, the registry MUST follow one of the errors defined in the table, even though '413 Payload Too Large' is not included. This discrepancy seems to cause confusion and allows for different implementations, leading to a lack of standardization and conformance:
#260 (comment)

gcr.io [..] fails with UNKNOWN: Bad Request.
quay.io [..] fails with 413 Request Entity Too Large (an nginx error, not a spec error)
docker.io [..] MANIFEST_INVALID: manifest invalid; http: request body too large

Am I looking at the wrong place and "413 Payload Too Large" is a valid error?

#293 specified the status code without updating the endpoints table. That's easy enough to fix with a PR to the endpoints table to add the status code.

Also, the "Error codes" are part of the JSON body that a registry MAY return. The status codes are part of the HTTP headers included with every valid HTTP response. These two things are not the same.

The HTTP 413 status code is documented in the RFC: https://datatracker.ietf.org/doc/html/rfc7231#section-6.5.11

Got it. Thank you for the explanations and the quick fix!