{"record":{"id":"a16e4fdd3bf4261e","repo":"apache/beam","slug":"failed-to-dial-server-at-v","errorCode":null,"errorMessage":"failed to dial server at %v","messagePattern":"failed to dial server at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/util/grpcx/dial.go","lineNumber":39,"sourceCode":"\t\"time\"\n\n\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/internal/errors\"\n\t\"google.golang.org/grpc\"\n)\n\n// Dial is a convenience wrapper over grpc.Dial. It can be overridden\n// to provide a customized dialing behavior.\nvar Dial = DefaultDial\n\n// DefaultDial is a dialer that specifies an insecure blocking connection with a timeout.\nfunc DefaultDial(ctx context.Context, endpoint string, timeout time.Duration) (*grpc.ClientConn, error) {\n\tctx, cancel := context.WithTimeout(ctx, timeout)\n\tdefer cancel()\n\n\tcc, err := grpc.DialContext(ctx, endpoint, grpc.WithInsecure(), grpc.WithBlock(),\n\t\tgrpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(math.MaxInt32)))\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to dial server at %v\", endpoint)\n\t}\n\treturn cc, nil\n}\n","sourceCodeStart":21,"sourceCodeEnd":43,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/util/grpcx/dial.go#L21-L43","documentation":"grpcx.DefaultDial dials a gRPC endpoint with WithBlock and a context timeout; this error wraps any failure from grpc.DialContext, meaning the client could not establish a connection to the server within the timeout. The underlying cause (unreachable, refused, TLS, timeout) is wrapped in the error chain.","triggerScenarios":"Calling grpcx.DefaultDial(ctx, endpoint) (or drivers using it to reach harness/workers) when the server isn't listening, the address/port is wrong, a firewall blocks it, or the connection isn't ready before the default timeout expires.","commonSituations":"Worker containers can't reach the driver/host endpoint (Docker/K8s networking, wrong hostname), server started after the client, port not published, or DNS resolution failure in a container network.","solutions":["Verify the endpoint address and port are correct and the server is listening","Check network reachability (telnet/nc) from client to endpoint; fix firewall/DNS/container networking","Ensure the server starts before the client dials","Inspect the wrapped cause with errors.Unwrap/%+v for the exact transport error"],"exampleFix":"// before\ncc, err := grpcx.DefaultDial(ctx, \"localhost:0\") // server on 50051\n// after\ncc, err := grpcx.DefaultDial(ctx, \"localhost:50051\")","handlingStrategy":"retry","validationCode":"conn, err := net.DialTimeout(\"tcp\", host, 2*time.Second)\nif err != nil {\n\treturn fmt.Errorf(\"endpoint %s unreachable before dial\", host)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"cc, err := grpcx.DefaultDial(ctx, endpoint)\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to dial\") {\n\t\t// retry with backoff or fail fast with clear message\n\t\treturn errors.Wrapf(err, \"server %s not reachable\", endpoint)\n\t}\n\treturn err\n}","preventionTips":["Health-check the server before dialing","Use correct hostnames resolvable from client containers","Publish/expose ports in Docker/K8s before connecting"],"tags":["grpc","network","dial","apache-beam"],"backgroundTag":"connection-refused","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}