# rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:50051: connect: connection refused"

- **ID:** `go/grpc-connection-refused`
- **Domain:** go
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Server is not running or the port is not open.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.7 | active | — | — |

## Workarounds

1. **** (100% success)
   ```
   lis, _ := net.Listen("tcp", ":50051"); s := grpc.NewServer(); pb.RegisterGreeterServer(s, &server{}); s.Serve(lis)
   ```
2. **** (90% success)
   ```
   Ensure client dials the correct address: grpc.Dial("localhost:50051", grpc.WithInsecure())
   ```

## Dead Ends

- **** — The server is not listening on any port. (90% fail)
- **** — Firewall is not the issue if the server is not running. (50% fail)
