{"record":{"id":"86bb2a33e59032bb","repo":"vitessio/vitess","slug":"error-connecting-to-s-using-v-protocol-v","errorCode":null,"errorMessage":"error connecting to %s using %v protocol: %v","messagePattern":"error connecting to (.+?) using (.+?) protocol: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vtbench/vtbench.go","lineNumber":167,"sourceCode":"\t\tswitch b.ConnParams.Protocol {\n\t\tcase MySQL:\n\t\t\tlog.V(5).Info(fmt.Sprintf(\"connecting to %s using mysql protocol...\", host))\n\t\t\tconn = &mysqlClientConn{}\n\t\t\terr = conn.connect(ctx, cp)\n\t\tcase GRPCVtgate:\n\t\t\tlog.V(5).Info(fmt.Sprintf(\"connecting to %s using grpc vtgate protocol...\", host))\n\t\t\tconn = &grpcVtgateConn{}\n\t\t\terr = conn.connect(ctx, cp)\n\t\tcase GRPCVttablet:\n\t\t\tlog.V(5).Info(fmt.Sprintf(\"connecting to %s using grpc vttablet protocol...\", host))\n\t\t\tconn = &grpcVttabletConn{}\n\t\t\terr = conn.connect(ctx, cp)\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unimplemented connection protocol %s\", b.ConnParams.Protocol.String())\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error connecting to %s using %v protocol: %v\", host, cp.Protocol.String(), err)\n\t\t}\n\n\t\t// XXX handle normalization and per-thread query templating\n\t\tquery, bindVars := b.getQuery(i)\n\t\tb.threads = append(b.threads, benchThread{\n\t\t\tb:        b,\n\t\t\ti:        i,\n\t\t\tconn:     conn,\n\t\t\tquery:    query,\n\t\t\tbindVars: bindVars,\n\t\t})\n\n\t\tif time.Now().After(report) {\n\t\t\tfmt.Printf(\"Created %d/%d connections after %v\\n\", i, b.Threads, time.Since(start))\n\t\t\treport = time.Now().Add(reportInterval)\n\t\t}\n\t}\n","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vtbench/vtbench.go#L149-L185","documentation":"After a connection of the selected protocol is created, createConns wraps any connect failure with this message identifying the host, protocol and underlying cause. The root problem is in the wrapped error (DNS, refused, TLS, auth), not in this message itself.","triggerScenarios":"Calling vtbench.Run / createConns when conn.connect(ctx, cp) returns an error for a host — unreachable tablet, wrong port, TLS mismatch, auth failure.","commonSituations":"Benchmarking against a tablet that is down or behind a firewall; wrong --port; MySQL credentials rejected; certificate/hostname mismatch with secure transport.","solutions":["Read the wrapped cause and fix it (connection refused → tablet down/port wrong; auth → fix credentials)","Verify the host:port with `mysql -h <host> -P <port>` or `vtctldclient GetTablets`","Check network/firewall/TLS settings between the bench runner and tablets"],"exampleFix":"// before\n// error connecting to tablet-0 using mysql protocol: dial tcp 10.0.0.5:3306: connect: connection refused\n// after\n// start the tablet or correct the port\nvtbenchclient.Run(ctx, \"--port\", \"15000\", ...)","handlingStrategy":"retry","validationCode":"conn, err := net.DialTimeout(\"tcp\", fmt.Sprintf(\"%s:%d\", host, port), 3*time.Second)\nif err != nil { return fmt.Errorf(\"host unreachable before bench: %v\", err) }\nconn.Close()","typeGuard":null,"tryCatchPattern":"if err := b.Run(ctx); err != nil {\n    var nerr net.Error\n    if errors.As(err, &nerr) || strings.Contains(err.Error(), \"error connecting to\") {\n        // backoff and retry; surface wrapped cause\n        return fmt.Errorf(\"bench target down: %w\", err)\n    }\n    return err\n}","preventionTips":["Pre-flight the tablet with a TCP/MySQL probe before benchmarking","Verify port flags against vtctldclient GetTablets output","Check TLS/auth settings match the tablet's configuration"],"tags":["vtbench","network","connection"],"backgroundTag":"connection-refused","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}