508 Loop Detected: what it means and what to do
A 508 means the server caught itself going in circles. Defined in RFC 5842 for WebDAV, it indicates that the server detected an infinite loop while processing a request with Depth: infinity, the mode that asks a server to act on a folder, and every folder inside it, and so on without limit. If the folder structure contains a loop, a shortcut or link that eventually points back to an ancestor, that walk never ends, and 508 is the server refusing to walk it forever.
If you ran into this in a file or sync tool
- Look for a folder that contains itself. A shortcut, symlink, or synced junction inside a folder that resolves back to that same folder (or one of its parents) is the classic trigger. Removing the circular shortcut ends the loop.
- Copy in smaller pieces. Sync or move subfolders one at a time. The piece that triggers the 508 is the piece containing the loop, which narrows the search quickly.
- Avoid nesting synced folders inside each other. Putting one cloud-synced folder inside another is a reliable way to manufacture loops that only appear during whole-tree operations.
If it is your server or API
- Keep 508 for genuine loop detection. It has a precise WebDAV meaning. Using it as a general error blurs client handling and your own logs.
- Track visited resources during deep walks. Cycle detection on canonical paths, not just literal paths, catches loops formed through links and aliases.
- Cap depth as a backstop. Even with cycle detection, a maximum traversal depth is cheap insurance against pathological structures.
Everyone: a 508 is a safety catch working correctly. Somewhere in the tree there is a path that leads back into itself, and finding that shortcut is the whole fix.
Common questions
Where would I ever see a 508? Almost exclusively around WebDAV based file services, sync tools, and network drives, during operations that walk an entire folder tree, such as copying, moving, or indexing everything at once. Ordinary web browsing essentially never produces one.
What creates a loop in a folder structure? A link inside the tree that points back to an ancestor of itself: a symbolic link to a parent folder, a Windows junction, or one synced folder nested inside another so the same content appears inside its own subtree.
Related errors