vitessio/vitess · error

vindexType %q not found

Error message

vindexType %q not found

What it means

CreateVindex looks up the requested vindex type in the process-wide vindex registry (populated by Register calls in package init()); if the type name is not registered it returns 'vindexType %q not found'. This is a vschema-configuration error: the type string in the keyspace's vschema JSON does not match any compiled-in or plugin-registered vindex.

Source

Thrown at go/vt/vtgate/vindexes/vindex.go:213

var registry = make(map[string]NewVindexFunc)

// Register registers a vindex factory under the specified vindexType.
// A duplicate vindexType will generate a panic.
// New vindexes will be created using these functions at the
// time of vschema loading.
func Register(vindexType string, newVindexFunc NewVindexFunc) {
	if _, ok := registry[vindexType]; ok {
		panic(vindexType + " is already registered")
	}
	registry[vindexType] = newVindexFunc
}

// CreateVindex creates a vindex of the specified type using the
// supplied params. The type must have been previously registered.
func CreateVindex(vindexType, name string, params map[string]string) (vindex Vindex, err error) {
	f, ok := registry[vindexType]
	if !ok {
		return nil, fmt.Errorf("vindexType %q not found", vindexType)
	}
	return f(name, params)
}

// Map invokes the Map implementation supplied by the vindex.
func Map(ctx context.Context, vindex Vindex, vcursor VCursor, rowsColValues [][]sqltypes.Value) ([]key.ShardDestination, error) {
	switch vindex := vindex.(type) {
	case MultiColumn:
		return vindex.Map(ctx, vcursor, rowsColValues)
	case SingleColumn:
		return vindex.Map(ctx, vcursor, firstColsOnly(rowsColValues))
	}
	return nil, vterrors.Errorf(vtrpcpb.Code_INTERNAL, "vindex '%T' does not have Map function", vindex)
}

// Verify invokes the Verify implementation supplied by the vindex.
func Verify(ctx context.Context, vindex Vindex, vcursor VCursor, rowsColValues [][]sqltypes.Value, ksids [][]byte) ([]bool, error) {
	switch vindex := vindex.(type) {

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Check the vindex type string in the vschema against the list of registered types (docs / vindexes package init() Register calls).
  2. Fix typos in the vschema JSON and re-apply it (ApplySchema/vtctl ApplyVSchema).
  3. Verify the VTGate binary version supports the vindex type; upgrade if it was added later.
  4. If using a custom vindex, ensure the package is imported (blank import) into the vtgate binary you run.
  5. Use a standard alternative (hash, binary_md5, unicode_loose_md5) if the intended type doesn't exist.

Example fix

// before (vschema)
"vindexes": { "my_vdx": { "type": "unicode_loose_md5_hash" } }
// after
"vindexes": { "my_vdx": { "type": "unicode_loose_md5" } }
Defensive patterns

Strategy: validation

Validate before calling

// before applying vschema, check type against known registry:
// grep -R 'Register("' go/vt/vtgate/vindexes/ | grep unicode_loose_md5
// or in Go:
types := []string{"hash","unicode_loose_md5","unicode_loose_xxhash","binary_md5", ...}
if !slices.Contains(types, v.Type) {
    return fmt.Errorf("unknown vindex type %q before ApplyVSchema", v.Type)
}

Try / catch

v, err := vindexes.CreateVindex(vType, name, params)
if err != nil {
    return fmt.Errorf("failed to create vindex %s: %w", name, err) // 'not found' → fix vschema type
}

Prevention

When it happens

Trigger: VSchema JSON contains a vindex with a "type" that is misspelled, unsupported by this Vitess build, or from a plugin that failed to load/import; calling vindexes.CreateVindex directly with an unregistered name.

Common situations: Typo like unicode_loose_md5hash vs unicode_loose_md5_hash; using a newer vindex type on an older VTGate; custom vindex in a separate binary that was never imported (blank import missing); case-sensitivity mistakes.

Related errors


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