vitessio/vitess · error

unsupported type: %d

Error message

unsupported type: %d

What it means

MySQLToType maps a MySQL wire-protocol column type byte to a vitess querypb.Type using the mysqlToType lookup table. If the byte has no entry in the table, this error is returned. It indicates the binary protocol contained a type code the library does not know.

Source

Thrown at go/sqltypes/type.go:289

	case Char:
		if flags&mysqlBinary != 0 {
			return Binary
		}
		if flags&mysqlEnum != 0 {
			return Enum
		}
		if flags&mysqlSet != 0 {
			return Set
		}
	}
	return typ
}

// MySQLToType computes the vitess type from mysql type and flags.
func MySQLToType(mysqlType byte, flags int64) (typ querypb.Type, err error) {
	result, ok := mysqlToType[mysqlType]
	if !ok {
		return 0, fmt.Errorf("unsupported type: %d", mysqlType)
	}
	return modifyType(result, flags), nil
}

// AreTypesEquivalent returns whether two types are equivalent.
func AreTypesEquivalent(mysqlTypeFromBinlog, mysqlTypeFromSchema querypb.Type) bool {
	return (mysqlTypeFromBinlog == mysqlTypeFromSchema) ||
		(mysqlTypeFromBinlog == VarChar && mysqlTypeFromSchema == VarBinary) ||
		// Binlog only has base type. But doesn't have per-column-flags to differentiate
		// various logical types. For Binary, Enum, Set types, binlog only returns Char
		// as data type.
		(mysqlTypeFromBinlog == Char && mysqlTypeFromSchema == Binary) ||
		(mysqlTypeFromBinlog == Char && mysqlTypeFromSchema == Enum) ||
		(mysqlTypeFromBinlog == Char && mysqlTypeFromSchema == Set) ||
		(mysqlTypeFromBinlog == Text && mysqlTypeFromSchema == Blob) ||
		(mysqlTypeFromBinlog == Int8 && mysqlTypeFromSchema == Uint8) ||
		(mysqlTypeFromBinlog == Int16 && mysqlTypeFromSchema == Uint16) ||
		(mysqlTypeFromBinlog == Int24 && mysqlTypeFromSchema == Uint24) ||

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Upgrade Vitess to a version whose mysqlToType table covers the type code
  2. Log the numeric mysqlType and map it manually via a local shim/patch
  3. Verify the packet source: ensure the type byte comes from a valid column definition

Example fix

// before
typ, err := sqltypes.MySQLToType(0x2b, flags) // unknown code
// after
if _, ok := supported(code); !ok { upgrade or default to VarBinary }
typ, err := sqltypes.MySQLToType(code, flags)
Defensive patterns

Strategy: try-catch

Validate before calling

// check the byte is in the known MySQL type range before calling
if mysqlType == 0 || mysqlType > 0x19 { log.Warn("suspect mysql type", slog.Int("type", int(mysqlType))) }

Try / catch

typ, err := sqltypes.MySQLToType(mysqlType, flags)
if err != nil {
  log.Warn("unknown mysql type, defaulting to VarBinary", slog.Any("error", err))
  typ = sqltypes.VarBinary
}

Prevention

When it happens

Trigger: Calling MySQLToType with an unknown/unmapped mysqlType byte, e.g. a new MySQL/MariaDB column type or a corrupted/zero type byte from the wire, typically from readColumnDefinition/parseComStmtExecute.

Common situations: Connecting to a newer MySQL version that introduced a type this Vitess version doesn't map; MariaDB-specific type codes reaching generic code; parsing hand-crafted or malformed column-definition packets.

Related errors


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