You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Oversized file upload destroys the socket before responding — client gets "Network error" instead of a 413 #481
Because the socket is already gone, this response never reaches the client. This causes three problems:
The client shows a misleading error.xhr.onerror in src/contexts/FileShareContext.tsx (line 225) fires, and the user sees "Network error during upload" instead of being told the file is too large.
The status code is wrong. Even if the response could be sent, 400 is the wrong code. 413 Payload Too Large is the correct one.
The limit is not enforced on a closed request.reject doesn't stop the function, so more data events can arrive before the socket closes and keep adding to totalSize.
Steps to Reproduce
Start the Rein server (npm run dev).
Open the file transfer UI and upload a file larger than 512 MB, or run:
head -c 600000000 /dev/zero > big.bin
curl -v -X POST http://localhost:3000/api/files/upload -F "file=@big.bin"
curl reports a connection reset or an empty reply instead of a JSON error, and the web UI shows "Network error during upload".
Expected Behavior
Expected Behavior
The server should stop buffering, send a 413 with a clear error message, and close the connection only after the response is sent:
In handleFileUpload, reply 413 for that error, sending Connection: close (or calling req.destroy() after res.end()), so the client gets the message. The frontend could then show "File exceeds 512 MB limit".
Desktop Operating System
Other
Client OS and browser
All clients / Any browser
Rein Version
1.0.0
Console Logs / Error Messages (Optional)
### Console Logs / Error Messages
Server: File upload error: Error: File too large
Client: Error: Network error during upload
curl: curl: (52) Empty reply from server / Connection reset by peer
if issue is valid assign me
Screenshots / Recordings (Optional)
Checklist
I have searched for existing issues to avoid duplicates
Activity
github-actions commentedon Nov 15, 2026
Discussions are carried on Discord.
Instead of commenting here, go to the Discord channel.
fix: return 413 for oversized uploads instead of destroying the socket (
Merge pull request #492 from RITVIKKAMASETTY/fix/upload-413-oversized