{
  "id": "go/grpc-unauthenticated-missing-metadata",
  "signature": "rpc error: code = Unauthenticated desc = missing authorization metadata",
  "signature_zh": "rpc error: code = Unauthenticated desc = 缺少授权元数据",
  "regex": "rpc\\ error:\\ code\\ =\\ Unauthenticated\\ desc\\ =\\ missing\\ authorization\\ metadata",
  "domain": "go",
  "category": "auth_error",
  "subcategory": null,
  "root_cause": "The server's auth interceptor requires an authorization token in incoming metadata, but the client did not attach one (or attached it under the wrong key).",
  "root_cause_type": "generic",
  "root_cause_zh": "服务端的鉴权拦截器要求传入元数据中包含授权令牌，但客户端未附加（或使用了错误的键）。",
  "versions": [
    {
      "version": "1.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Disables authentication entirely, exposing protected endpoints",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "May still fail if the interceptor expects a specific metadata key like \"authorization\" with a \"Bearer \" prefix",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.93,
      "how": "md := metadata.Pairs(\"authorization\", \"Bearer \"+token)\nctx := metadata.NewOutgoingContext(ctx, md)\nresp, err := client.Get(ctx, req)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "func authUnary(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, inv grpc.UnaryInvoker, opts ...grpc.CallOption) error {\n  ctx = metadata.AppendToOutgoingContext(ctx, \"authorization\", \"Bearer \"+getToken())\n  return inv(ctx, method, req, reply, cc, opts...)\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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-12-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}