508 Loop Detected
Meaning
The server detected an infinite loop while processing the request. Typically used in the context of WebDAV when a recursive request has encountered a looping situation (like a circular reference in PROPFIND depth requests).
When to Use
When a WebDAV server or similar system encounters a situation where processing a request leads to an infinite loop, often because of a resource referring to itself or cyclical relationships in the data.
Example
A WebDAV PROPFIND on a directory that contains a symbolic link back to a parent directory could cause a loop; the server returns 508 Loop Detected to indicate it aborted the operation due to the loop.
When Not to Use
Do not use outside of scenarios where a loop in the request processing is actually detected. This code is mainly for specific extension contexts (WebDAV). Regular infinite loops in server code would typically just cause a 500 if anything, since the server might not catch and handle it explicitly with a 508.
Source
RFC 5842 (WebDAV)