# rpc error: code = Unavailable desc = grpc: the server has been stopped

- **ID:** `go/grpc-server-stopped`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

A call was made against a grpc.Server after GracefulStop()/Stop() completed, or before Serve() started.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| google.golang.org/grpc 1.50+ | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   Order shutdown correctly:
// on SIGTERM
srv.GracefulStop() // stops accepting, drains in-flight
lis.Close()
// construct a fresh server on restart
   ```
2. **** (88% success)
   ```
   Guard server lifecycle with sync.Once and a ready channel; only issue calls after Serve() has started (use a health check).
   ```

## Dead Ends

- **** — grpc.Server cannot be restarted after Stop; you must construct a new one. (95% fail)
- **** — Hides a lifecycle bug where the server is being used after shutdown. (80% fail)
