Too Many Open Files
The number of concurrent network requests (MAX_CONCURRENCY) is set to 128 by default.
Every network request maps to an open socket, which is represented as a file on UNIX systems.
If you see error messages like error trying to connect: tcp open error: Too many open files (os error 24) then you ran out of file handles.
You can either reduce the number of concurrent requests with the --max-concurrency option or increase the number of allowed open files on your system.
For example, to reduce the number of concurrent requests to 50:
lychee --max-concurrency 50 https://example.comTo increase the number of allowed open files, you can use the ulimit command on UNIX systems.
For example, to increase the limit to 4096:
ulimit -n 4096For permanent increases (e.g., across reboots), use launchctl to set system limits:
sudo launchctl limit maxfiles 4096 unlimitedThen apply per-session with ulimit -n 4096. This sets a soft limit of 4096 and removes the hard cap.
For system-wide boot changes, create /Library/LaunchDaemons/limit.maxfiles.plist with XML keys for <key>LimitLoadToSessionType</key><string>System</string> and limits—see Apple docs.
Windows
Section titled “Windows”On Windows, you can increase the limit by modifying the registry.
- Open the Registry Editor (
regedit). - Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip \Parameters. - Create a new
DWORDvalue namedMaxUserPortand set it to65534. - Create another
DWORDvalue namedTcpTimedWaitDelayand set it to30. - Restart your computer for the changes to take effect.