vitessio/vitess · error

unimplemented connection protocol %s

Error message

unimplemented connection protocol %s

What it means

vtbench's createConns switches on b.ConnParams.Protocol to construct the right connection type; the default case returns this error for protocol values with no implementation (e.g. anything not mysql/tcp, unix, or grpc vttablet). It is a programming/config error: the chosen protocol is not supported by vtbench.

Source

Thrown at go/vtbench/vtbench.go:163

		var conn clientConn
		var err error

		switch b.ConnParams.Protocol {
		case MySQL:
			log.V(5).Info(fmt.Sprintf("connecting to %s using mysql protocol...", host))
			conn = &mysqlClientConn{}
			err = conn.connect(ctx, cp)
		case GRPCVtgate:
			log.V(5).Info(fmt.Sprintf("connecting to %s using grpc vtgate protocol...", host))
			conn = &grpcVtgateConn{}
			err = conn.connect(ctx, cp)
		case GRPCVttablet:
			log.V(5).Info(fmt.Sprintf("connecting to %s using grpc vttablet protocol...", host))
			conn = &grpcVttabletConn{}
			err = conn.connect(ctx, cp)
		default:
			return fmt.Errorf("unimplemented connection protocol %s", b.ConnParams.Protocol.String())
		}

		if err != nil {
			return fmt.Errorf("error connecting to %s using %v protocol: %v", host, cp.Protocol.String(), err)
		}

		// XXX handle normalization and per-thread query templating
		query, bindVars := b.getQuery(i)
		b.threads = append(b.threads, benchThread{
			b:        b,
			i:        i,
			conn:     conn,
			query:    query,
			bindVars: bindVars,
		})

		if time.Now().After(report) {
			fmt.Printf("Created %d/%d connections after %v\n", i, b.Threads, time.Since(start))

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Use a supported protocol value (mysql, grpc-vttablet, etc. — see vtbench flag help)
  2. Fix the --protocol flag spelling
  3. If a new protocol is genuinely needed, add a case in createConns implementing conn.connect for it

Example fix

// before
vtbenchclient.Run(ctx, "--protocol", "grpc-vtctl", ...)
// after
vtbenchclient.Run(ctx, "--protocol", "grpc-vttablet", ...)
Defensive patterns

Strategy: validation

Validate before calling

supported := map[string]bool{"mysql": true, "grpc-vttablet": true}
if !supported[protocol.String()] {
    return fmt.Errorf("protocol %s unsupported by vtbench", protocol)
}

Type guard

func protocolSupported(p querypb.VtbenchProtocol) bool {
    switch p {
    case querypb.VtbenchProtocol_MYSQL, querypb.VtbenchProtocol_GRPC_VTTABLET:
        return true
    }
    return false
}

Try / catch

if err := b.Run(ctx); err != nil {
    if strings.Contains(err.Error(), "unimplemented connection protocol") {
        // surface flag help / supported protocols to the user
    }
    return err
}

Prevention

When it happens

Trigger: Passing --protocol (or a conn params protocol string) with an unsupported value when calling vtbench.Run / createConns, e.g. an experimental or internal protocol flag that vtbench does not implement.

Common situations: Typo in the --protocol flag value; copying flags from another vitess tool that supports more protocols; new protocol added to ConnParams but not wired into vtbench.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/c8764ddc799bdb90. Report an issue: GitHub.