go grpc_error ai_generated partial

rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp: lookup service: no such host"

ID: go/grpc-unavailable

Also available as: JSON · Markdown
80%Fix Rate
85%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1 active

Root Cause

gRPC UNAVAILABLE status indicates the service cannot be reached. Causes: server not running, DNS resolution failure, TLS mismatch, or load balancer health check failure.

generic

Workarounds

  1. 88% success Verify the gRPC server is running and the address is correct
    Use grpcurl to test: grpcurl -plaintext localhost:50051 list
    Check if the server is listening: ss -tlnp | grep 50051

    Sources: https://github.com/fullstorydev/grpcurl

  2. 85% success Match TLS configuration between client and server
    If server uses grpc.Creds(), client must use grpc.WithTransportCredentials(). If server uses insecure, client must use grpc.WithTransportCredentials(insecure.NewCredentials()).

    Sources: https://pkg.go.dev/google.golang.org/grpc#WithTransportCredentials

Dead Ends

Common approaches that don't work:

  1. Increase gRPC MaxRecvMsgSize to fix connection errors 90% fail

    MaxRecvMsgSize controls message size limits, not connection establishment — UNAVAILABLE means the transport layer cannot connect

  2. Disable gRPC keepalive pings 75% fail

    Keepalives detect dead connections — disabling them hides connection failures without fixing the root cause

Error Chain

Leads to:
Preceded by:
Frequently confused with: