Skip to content

Commit e0b7f91

Browse files
committed
docs: troubleshoot "Stream is being deleted" during long waits
1 parent c80b85e commit e0b7f91

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

docs/tasks/streams.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,3 +873,12 @@ Prior to SDK 4.1.0, streams used the older metadata-based API. If you're on an e
873873

874874
- Input streams require SDK **4.4.2 or later** and the default streams (v2) infrastructure. Ensure you're on a recent SDK and not using the legacy metadata.stream() API.
875875
- If `.on()` or `.once()` throw, follow the error message to enable v2 streams (they are default in 4.1.0+).
876+
877+
### "Stream is being deleted" during long waits
878+
879+
If a stream is created but stays empty for ~1 hour (for example, during a long `wait.forToken()` or `wait.for()`), the streams backend may garbage-collect it. When the run resumes and tries to use the stream, you'll see `S2Error: Stream is being deleted` and the task retries from the beginning.
880+
881+
Two ways to avoid this:
882+
883+
- Close the stream before the wait and open a new one when the run resumes.
884+
- Write a heartbeat record to the stream every 20–30 minutes during the wait so it's never empty long enough to be deleted.

0 commit comments

Comments
 (0)