{
  "id": "go/grpc-permission-denied-tls",
  "signature": "rpc error: code = Unavailable desc = connection error: desc = \"transport: authentication handshake failed: tls: first record does not look like a TLS handshake\"",
  "signature_zh": "rpc 错误：code = Unavailable desc = 连接错误：传输：认证握手失败：tls: 首条记录不像 TLS 握手",
  "regex": "rpc\\ error:\\ code\\ =\\ Unavailable\\ desc\\ =\\ connection\\ error:\\ desc\\ =\\ \"transport:\\ authentication\\ handshake\\ failed:\\ tls:\\ first\\ record\\ does\\ not\\ look\\ like\\ a\\ TLS\\ handshake\"",
  "domain": "go",
  "category": "auth_error",
  "subcategory": null,
  "root_cause": "The client tried to use TLS against a plaintext gRPC server, or vice versa. Typically happens when the client uses credentials.NewTLS but the server was started without TLS credentials.",
  "root_cause_type": "generic",
  "root_cause_zh": "客户端尝试对明文 gRPC 服务端使用 TLS，或反之。通常发生在客户端使用 credentials.NewTLS 但服务端未启用 TLS 凭据启动时。",
  "versions": [
    {
      "version": "google.golang.org/grpc 1.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The handshake fails before certificate verification; the server is not speaking TLS at all.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The handshake fails immediately due to protocol mismatch, not latency.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "// server\ncreds, _ := credentials.NewServerTLSFromFile(\"server.crt\", \"server.key\")\ns := grpc.NewServer(grpc.Creds(creds))\n// client\ncreds, _ := credentials.NewClientTLSFromFile(\"ca.crt\", \"\")\nconn, _ := grpc.Dial(addr, grpc.WithTransportCredentials(creds))",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "if os.Getenv(\"ENV\") == \"local\" {\n    conn, _ = grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))\n} else {\n    conn, _ = grpc.Dial(addr, grpc.WithTransportCredentials(creds))\n}",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-03",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}