Error1 reports
Fix StreamInterruptedError
in tRPC
✅ Solution
StreamInterruptedError in tRPC often arises when a stream is prematurely terminated by the client (e.g., navigating away) before all data is received. To fix this, ensure your server-side streaming procedure gracefully handles cancellation signals by closing the stream or `AsyncGenerator` when the `signal` is aborted, preventing further data emissions. Additionally, catch any potential exceptions thrown by the underlying stream (e.g., if the resource it's reading from disappears) and ensure they are properly handled and propagated to the client as a trpc error instead of letting them interrupt the main tRPC stream.
Related Issues
Real GitHub issues where developers encountered this error:
Timeline
First reported:Feb 7, 2025
Last reported:Feb 7, 2025