{"id":1263,"hash":"a7eda646e9e2816e6b0ceff2b16bdedf3678e5eb45be29922c835b4e1183b9ad","pattern":"server error: rpc error: code = Unavailable desc = transport is closing&quot; in gRPC","full_message":"I have a grpc server and a client (in my blog project). when I run the server, It seems everything is ok, when I run the client, I face this error, and both server and client close.\n\nrpc error: code = Unavailable desc = transport is closing\n\nI think error is related to this piece of code:\n\nfunc newPost(c proto_blog.BlogServiceClient) {\n    fmt.Println(\"Starting to do a Unary RPC\")\n    req := &proto_blog.ReqNewPost{\n        Title: \"How can we make an gRPC server?\",\n        Content: \"First You have to.....\\nAt the end, you have to....\",\n        Author: \"Arsham Ahora\",\n        Date: fmt.Sprint(time.Now()),\n    }\n\n    res, err := c.NewPost(context.Background(), req)\n    if err != nil {\n        log.Fatalf(\"Error calling greet server: %v\", err)\n    }\n    log.Printf(\"Response from Greet: %v\", res.Id)\n}\n\n** I noticed this error is not related to whether you have Unary or Streaming.","ecosystem":"go","package_name":"protocol-buffers","package_version":null,"solution":"I want to list some possible reasons cause code = Unavailable desc = transport is closing on gRPC per gRPC faq, in case of someone meets those reasons.\n\nThis error means the connection the RPC is using was closed, and there are many possible reasons, including:\n\nmis-configured transport credentials, connection failed on handshaking\nbytes disrupted, possibly by a proxy in between\nserver shutdown\nKeepalive parameters caused connection shutdown, for example if you have configured your server to terminate connections regularly to trigger DNS lookups. If this is the case, you may want to increase your MaxConnectionAgeGrace, to allow longer RPC calls to finish.\n\nIt can be tricky to debug this because the error happens on the client side but the root cause of the connection being closed is on the server side. Turn on logging on both client and server, and see if there are any transport errors.\n\nThe default logger is controlled by environment variables. Turn everything on like this:\n\n$ export GRPC_GO_LOG_VERBOSITY_LEVEL=99\n$ export GRPC_GO_LOG_SEVERITY_LEVEL=info","confidence":0.7000000000000001,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/67338307/server-error-rpc-error-code-unavailable-desc-transport-is-closing-in-grpc","votes":4,"created_at":"2026-04-19T04:52:44.563368+00:00","updated_at":"2026-04-19T04:52:44.563368+00:00"}