Example HTTP Response
HTTP/1.1 416 Range Not Satisfiable
Content-Range: bytes */5000- Range header exceeds file size
- Invalid byte range requested
- Seeking past end of resource
What does this mean?
You asked for pages 500-600 of a 100-page book! The server can't give you bytes that don't exist.
Technical Definition
The range specified by the Range header in the request cannot be fulfilled.
RFC Says
"The 416 (Range Not Satisfiable) status code indicates that none of the ranges in the request's Range header field overlap the current extent of the selected resource or that the set of ranges requested has been rejected due to invalid ranges or an excessive request of small or overlapping ranges."
Plain English:
416 means 'The byte range you requested doesn't exist in this resource.' This happens with range requests (like video streaming or download resumption) when you ask for bytes 1000-2000 of a file that's only 500 bytes long. The response should include a Content-Range header showing the actual size.
Common Misinterpretation
Only return 416 for actual range requests with a Range header. Make sure to include a Content-Range header in the response showing the actual size of the resource so clients can retry with a valid range.
Ready-to-use code for returning this HTTP status in your application:
// Express.js
app.get('/example', (req, res) => {
res.status(416).json({
error: 'Range Not Satisfiable',
message: 'Your error message here'
});
});
// Native HTTP
const http = require('http');
http.createServer((req, res) => {
res.writeHead(416, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
error: 'Range Not Satisfiable',
message: 'Your error message here'
}));
}).listen(3000);