HTTP 416 Range Not Satisfiable indicates the Range header in the request specifies a byte range that cannot be fulfilled — typically because the range exceeds the resource's size. The server MUST include a Content-Range header with the actual resource size: Content-Range: bytes */12345. This commonly occurs when a resumed download references a file that has since been truncated or replaced.
Response includes the status code, standard headers (including Content-Type), and a small diagnostic JSON body describing the request and returned status.
Simulator URL (copy in the app after load — not a normal link):
https://httpstatus.com/api/status/416
Example request:
curl -i "https://httpstatus.com/api/status/416"The range specified by the Range header cannot be satisfied (e.g., requested bytes exceed file size). Response should include Content-Range header indicating valid range.
On this code, Inspector focuses on semantics, headers, and correctness warnings that commonly affect clients and caches.
HTTP 416 Range Not Satisfiable has specific technical implications for API design, caching, and client behavior. Understanding the precise semantics helps distinguish it from similar status codes and implement correct error handling. The response should include a descriptive body following a consistent error schema (like RFC 7807 Problem Details) so clients can programmatically handle the error.
// Handle 416 Range Not Satisfiable in Express
app.use((err, req, res, next) => {
if (err.status === 416) {
return res.status(416).json({
type: 'https://api.example.com/errors/range-not-satisfiable',
title: 'Range Not Satisfiable',
status: 416,
detail: err.message
});
}
next(err);
});from fastapi import HTTPException
# Raise 416 Range Not Satisfiable
raise HTTPException(
status_code=416,
detail={
'type': 'range_not_satisfiable',
'message': 'Descriptive error for 416 Range Not Satisfiable'
}
)// Spring Boot 416 Range Not Satisfiable handling
@ExceptionHandler(CustomRangeNotSatisfiableException.class)
public ResponseEntity<ErrorResponse> handleRangeNotSatisfiable(
CustomRangeNotSatisfiableException ex) {
return ResponseEntity.status(416)
.body(new ErrorResponse("Range Not Satisfiable", ex.getMessage()));
}// Return 416 Range Not Satisfiable
func errorHandler(w http.ResponseWriter, message string) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(416)
json.NewEncoder(w).Encode(map[string]any{
"status": 416,
"error": "Range Not Satisfiable",
"message": message,
})
}