{
  "id": "go/grpc-permission-denied-role",
  "signature": "rpc error: code = PermissionDenied desc = user does not have permission to access this resource",
  "signature_zh": "rpc错误：代码=权限被拒绝 描述=用户无权访问此资源",
  "regex": "rpc\\ error:\\ code\\ =\\ PermissionDenied\\ desc\\ =\\ user\\ does\\ not\\ have\\ permission\\ to\\ access\\ this\\ resource",
  "domain": "go",
  "category": "auth_error",
  "subcategory": null,
  "root_cause": "The authenticated user lacks the required role or permissions for the requested RPC, as enforced by server-side authorization logic.",
  "root_cause_type": "generic",
  "root_cause_zh": "经过身份验证的用户缺少请求RPC所需的角色或权限，由服务器端授权逻辑强制执行。",
  "versions": [
    {
      "version": "1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Re-authenticating with the same credentials.",
      "why_fails": "Same user, same permissions; still denied.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using a different RPC with the same user.",
      "why_fails": "Permission issue is user-specific, not method-specific.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Request elevated permissions from the admin and use a new token.",
      "success_rate": 0.9,
      "how": "token := getAdminToken() // obtain token with required role\nmd := metadata.Pairs(\"authorization\", \"Bearer \"+token)\nctx := metadata.NewOutgoingContext(context.Background(), md)",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a service account with necessary roles if available.",
      "success_rate": 0.85,
      "how": "// Configure gRPC with service account credentials\nconn, _ := grpc.Dial(target, grpc.WithPerRPCCredentials(oauth.NewServiceAccountTokenSource(\"path/to/key.json\", \"scope\")))",
      "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-09-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}