ELOOP
Linux / POSIXERRORNotableFile SystemHIGH confidence
Too Many Levels of Symbolic Links
What this means
The kernel followed too many symbolic links while resolving a path, indicating a circular symlink chain. Linux gives up after 40 hops to prevent infinite loops. This almost always indicates a misconfigured deployment or packaging script.
Why it happens
- 1Two symlinks point to each other, creating an infinite loop.
- 2A chain of symlinks eventually circles back to a link already traversed.
- 3A deployment script created symlinks incorrectly, pointing to themselves.
How to reproduce
Two symbolic links that point to each other.
trigger — this will error
trigger — this will error
$ ln -s /tmp/loop-b /tmp/loop-a $ ln -s /tmp/loop-a /tmp/loop-b $ cat /tmp/loop-a/file.txt cat: /tmp/loop-a/file.txt: Too many levels of symbolic links
expected output
cat: /tmp/loop-a/file.txt: Too many levels of symbolic links
Fix
Identify and remove circular symlinks
WHEN When resolving a path causes ELOOP
Identify and remove circular symlinks
# Find symlinks in /tmp and see where they point
find /tmp -type l -exec ls -la {} \;
# Use readlink to trace the chain
readlink -f /tmp/loop-a # Will fail or show max depth reached
# Remove the circular link
rm /tmp/loop-b
ln -s /actual/target /tmp/loop-bWhy this works
Removing one link in the cycle breaks the loop, allowing path resolution to succeed.
Sources
Official documentation ↗
Linux Programmer Manual errno(3)
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev