{"record":{"id":"66168c5b234f91c7","repo":"apache/beam","slug":"failed-to-connect-v","errorCode":null,"errorMessage":"failed to connect: %v\n","messagePattern":"failed to connect: (.+?)\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/harness/worker_status.go","lineNumber":50,"sourceCode":"\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/internal/errors\"\n\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/log\"\n\tfnpb \"github.com/apache/beam/sdks/v2/go/pkg/beam/model/fnexecution_v1\"\n\t\"google.golang.org/grpc\"\n)\n\n// workerStatusHandler stores the communication information of WorkerStatus API.\ntype workerStatusHandler struct {\n\tconn             *grpc.ClientConn\n\tshouldShutdown   int32\n\twg               sync.WaitGroup\n\tcache            *statecache.SideInputCache\n\tmetStoreToString func(*strings.Builder)\n}\n\nfunc newWorkerStatusHandler(ctx context.Context, endpoint string, cache *statecache.SideInputCache, metStoreToString func(*strings.Builder)) (*workerStatusHandler, error) {\n\tsconn, err := dial(ctx, endpoint, \"status\", 60*time.Second)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to connect: %v\\n\", endpoint)\n\t}\n\treturn &workerStatusHandler{conn: sconn, shouldShutdown: 0, cache: cache, metStoreToString: metStoreToString}, nil\n}\n\nfunc (w *workerStatusHandler) isAlive() bool {\n\treturn atomic.LoadInt32(&w.shouldShutdown) == 0\n}\n\nfunc (w *workerStatusHandler) shutdown() {\n\tatomic.StoreInt32(&w.shouldShutdown, 1)\n}\n\n// start starts the reader to accept WorkerStatusRequest and send WorkerStatusResponse with WorkerStatus API.\nfunc (w *workerStatusHandler) start(ctx context.Context) error {\n\tstatusClient := fnpb.NewBeamFnWorkerStatusClient(w.conn)\n\tstub, err := statusClient.WorkerStatus(ctx)\n\tif err != nil {\n\t\tlog.Errorf(ctx, \"status client not established: %v\", err)","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/harness/worker_status.go#L32-L68","documentation":"newWorkerStatusHandler dials the runner's worker status gRPC endpoint (60s timeout) to stream status/liveness info. If the dial fails, it wraps the error with the endpoint. Without this connection the harness cannot serve worker status, though the pipeline may still process data.","triggerScenarios":"MainWithOptions starting a harness whose status endpoint is unreachable: wrong/empty endpoint URL from the runner provisioning, DNS failure, status service not yet up, TLS mismatch, or firewall blocking the port.","commonSituations":"Misconfigured statusApiServiceDescriptor in the runner, slow runner startup exceeding the 60s dial window in constrained environments, Kubernetes/network policies blocking harness→runner traffic, custom runners that omit status service support.","solutions":["Verify the status endpoint URL the runner provisioned is reachable from the worker (curl/nc the host:port).","Check DNS resolution and network policies/firewalls on the worker subnet.","Check TLS settings match the runner's gRPC server configuration.","If the runner starts the status service late, retry or increase the dial budget; if the runner lacks status support, ensure it provides the endpoint or handle startup failure gracefully."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if endpoint == \"\" { return errors.New(\"worker status endpoint not provisioned\") }","typeGuard":null,"tryCatchPattern":"h, err := newWorkerStatusHandler(ctx, endpoint, cache, metToString)\nif err != nil {\n    log.Warnf(\"status handler unavailable: %v (continuing without status)\", err)\n    h = nil // degrade gracefully when status is optional\n}","preventionTips":["Provision and verify the status endpoint before harness start","Allow status port traffic in network policies","Increase dial budget in slow-start environments"],"tags":["go","grpc","network","beam","status"],"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"}