HTTP 507 Insufficient Storage — Disk Full & Quota Errors
The server is unable to store the representation needed to complete the request. Used in WebDAV implementations and file upload scenarios when the server has run out of disk space.
When to Return 507
Return 507 when a file upload or document creation fails because the server has insufficient storage. More specific than 500 for storage-related failures.
Common Causes
- Server disk full during file upload
- User storage quota exceeded
- Database tablespace full
- WebDAV collection storage limit reached
HTTP Response Example
HTTP/1.1 507 Insufficient Storage
Content-Type: application/json
{"error": "Insufficient Storage", "message": "Server storage capacity reached"}Code Examples
Express.js
app.post('/upload', async (req, res) => {
try {
const available = await checkDiskSpace()
if (available < req.headers['content-length']) {
return res.status(507).json({
error: 'Insufficient Storage',
message: 'Server storage is full. Contact support.',
})
}
await saveFile(req)
res.status(201).json({ message: 'File uploaded' })
} catch (err) {
if (err.code === 'ENOSPC') {
return res.status(507).json({ error: 'Insufficient Storage' })
}
res.sendStatus(500)
}
})Next.js App Router
export async function POST(request: Request) {
try {
const data = await request.arrayBuffer()
await writeFile(data)
return Response.json({ message: 'Saved' }, { status: 201 })
} catch (err) {
if (err.code === 'ENOSPC') {
return Response.json({ error: 'Insufficient Storage' }, { status: 507 })
}
return Response.json({ error: 'Internal Server Error' }, { status: 500 })
}
}Related Status Codes
Frequently Asked Questions
What does HTTP 507 Insufficient Storage mean?
The server is unable to store the representation needed to complete the request. Used in WebDAV implementations and file upload scenarios when the server has run out of disk space.
When should an API return 507?
Return 507 when a file upload or document creation fails because the server has insufficient storage. More specific than 500 for storage-related failures.
What causes an HTTP 507 error?
Common causes: Server disk full during file upload; User storage quota exceeded; Database tablespace full; WebDAV collection storage limit reached.
