# INTERNAL: grpc: stream 45 closed with error: stream idled out

- **ID:** `grpc/stream-idle-timeout-reset`
- **Domain:** grpc
- **Category:** runtime_error
- **Error Code:** `GRPC_STREAM_IDLE_TIMEOUT`
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

gRPC server closed an idle stream due to per-stream idle timeout configuration, often caused by client not sending data within the timeout window.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| gRPC v1.50.x | active | — | — |
| gRPC v1.62.x | active | — | — |
| gRPC v1.64.x | active | — | — |

## Workarounds

1. **Increase the server-side stream idle timeout using gRPC server option: `server = grpc.server(futures.ThreadPoolExecutor(max_workers=10), options=[('grpc.max_connection_idle_ms', 60000)])` in Python, or set `GRPC_ARG_MAX_CONNECTION_IDLE_MS` in C++. This prevents idle streams from being closed too aggressively.** (85% success)
   ```
   Increase the server-side stream idle timeout using gRPC server option: `server = grpc.server(futures.ThreadPoolExecutor(max_workers=10), options=[('grpc.max_connection_idle_ms', 60000)])` in Python, or set `GRPC_ARG_MAX_CONNECTION_IDLE_MS` in C++. This prevents idle streams from being closed too aggressively.
   ```
2. **Ensure the client sends periodic data or uses bidirectional streaming with a heartbeat message every 10-15 seconds to keep the stream active.** (80% success)
   ```
   Ensure the client sends periodic data or uses bidirectional streaming with a heartbeat message every 10-15 seconds to keep the stream active.
   ```
3. **Reduce the server's `max_connection_age_ms` and `max_connection_age_grace_ms` to force connection rebalancing, which can reset idle counters.** (75% success)
   ```
   Reduce the server's `max_connection_age_ms` and `max_connection_age_grace_ms` to force connection rebalancing, which can reset idle counters.
   ```

## Dead Ends

- **** — Keepalive pings prevent connection-level idle, but per-stream idle timeouts are separate and not affected by keepalive pings. (70% fail)
- **** — This controls minimum allowed ping interval, not stream idle timeout; it doesn't prevent stream closure due to inactivity. (60% fail)
- **** — Removing keepalive can cause connection drops, but stream idle timeout is a separate server-side policy that still applies. (50% fail)
