# rpc error: code = Unavailable desc = connection error: desc = "transport: authentication handshake failed: tls: first record does not look like a TLS handshake"

- **ID:** `go/grpc-permission-denied-tls-mismatch`
- **Domain:** go
- **Category:** auth_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The client is attempting TLS but the server is serving plaintext (or vice versa). Common when mixing grpc.WithInsecure() with a TLS server or dialing a plaintext port with credentials.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.40+ | active | — | — |

## Workarounds

1. **** (93% success)
   ```
   // TLS server
creds, _ := credentials.NewServerTLSFromFile("server.crt", "server.key")
s := grpc.NewServer(grpc.Creds(creds))
// TLS client
creds, _ := credentials.NewClientTLSFromFile("ca.crt", "")
conn, _ := grpc.Dial(addr, grpc.WithTransportCredentials(creds))
   ```
2. **** (90% success)
   ```
   import "google.golang.org/grpc/credentials/insecure"
conn, _ := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
   ```

## Dead Ends

- **** — Silences TLS but breaks against a TLS-only server; also disables security in production (80% fail)
- **** — Does not help when the server isn't speaking TLS at all; and it weakens security (85% fail)
