HTTP

HTTP 400 Bad Request vs 416 Range Not Satisfiable

Both HTTP 400 (Bad Request) and 416 (Range Not Satisfiable) belong to the 4xx Client Error category. 400 indicates that the server cannot process the request due to malformed syntax, invalid request message framing, or deceptive request routing. Meanwhile, 416 means that the server cannot serve the requested byte range. The Range header value is outside the resource's size.

Description

The server cannot process the request due to malformed syntax, invalid request message framing, or deceptive request routing.

When You See It

When sending malformed JSON, missing required fields, or invalid query parameters.

How to Fix

Check the request body format, validate all required fields, and ensure proper encoding.

Description

The server cannot serve the requested byte range. The Range header value is outside the resource's size.

When You See It

When requesting a byte range beyond the file's actual size.

How to Fix

Check the Content-Range in the response for the actual file size and adjust your Range header.

Key Differences

1.

HTTP 400: The server cannot process the request due to malformed syntax, invalid request message framing, or deceptive request routing.

2.

HTTP 416: The server cannot serve the requested byte range. The Range header value is outside the resource's size.

3.

You encounter 400 when when sending malformed JSON, missing required fields, or invalid query parameters.

4.

You encounter 416 when when requesting a byte range beyond the file's actual size.

When to Use Which

For 400 (Bad Request): Check the request body format, validate all required fields, and ensure proper encoding. For 416 (Range Not Satisfiable): Check the Content-Range in the response for the actual file size and adjust your Range header.

Learn More