{"record":{"id":"72d1545fd606b73c","repo":"vitessio/vitess","slug":"unsupported-type-d","errorCode":null,"errorMessage":"unsupported type: %d","messagePattern":"unsupported type: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/sqltypes/type.go","lineNumber":289,"sourceCode":"\tcase Char:\n\t\tif flags&mysqlBinary != 0 {\n\t\t\treturn Binary\n\t\t}\n\t\tif flags&mysqlEnum != 0 {\n\t\t\treturn Enum\n\t\t}\n\t\tif flags&mysqlSet != 0 {\n\t\t\treturn Set\n\t\t}\n\t}\n\treturn typ\n}\n\n// MySQLToType computes the vitess type from mysql type and flags.\nfunc MySQLToType(mysqlType byte, flags int64) (typ querypb.Type, err error) {\n\tresult, ok := mysqlToType[mysqlType]\n\tif !ok {\n\t\treturn 0, fmt.Errorf(\"unsupported type: %d\", mysqlType)\n\t}\n\treturn modifyType(result, flags), nil\n}\n\n// AreTypesEquivalent returns whether two types are equivalent.\nfunc AreTypesEquivalent(mysqlTypeFromBinlog, mysqlTypeFromSchema querypb.Type) bool {\n\treturn (mysqlTypeFromBinlog == mysqlTypeFromSchema) ||\n\t\t(mysqlTypeFromBinlog == VarChar && mysqlTypeFromSchema == VarBinary) ||\n\t\t// Binlog only has base type. But doesn't have per-column-flags to differentiate\n\t\t// various logical types. For Binary, Enum, Set types, binlog only returns Char\n\t\t// as data type.\n\t\t(mysqlTypeFromBinlog == Char && mysqlTypeFromSchema == Binary) ||\n\t\t(mysqlTypeFromBinlog == Char && mysqlTypeFromSchema == Enum) ||\n\t\t(mysqlTypeFromBinlog == Char && mysqlTypeFromSchema == Set) ||\n\t\t(mysqlTypeFromBinlog == Text && mysqlTypeFromSchema == Blob) ||\n\t\t(mysqlTypeFromBinlog == Int8 && mysqlTypeFromSchema == Uint8) ||\n\t\t(mysqlTypeFromBinlog == Int16 && mysqlTypeFromSchema == Uint16) ||\n\t\t(mysqlTypeFromBinlog == Int24 && mysqlTypeFromSchema == Uint24) ||","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/sqltypes/type.go#L271-L307","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Upgrade Vitess to a version whose mysqlToType table covers the type code","Log the numeric mysqlType and map it manually via a local shim/patch","Verify the packet source: ensure the type byte comes from a valid column definition"],"exampleFix":"// before\ntyp, err := sqltypes.MySQLToType(0x2b, flags) // unknown code\n// after\nif _, ok := supported(code); !ok { upgrade or default to VarBinary }\ntyp, err := sqltypes.MySQLToType(code, flags)","handlingStrategy":"try-catch","validationCode":"// check the byte is in the known MySQL type range before calling\nif mysqlType == 0 || mysqlType > 0x19 { log.Warn(\"suspect mysql type\", slog.Int(\"type\", int(mysqlType))) }","typeGuard":null,"tryCatchPattern":"typ, err := sqltypes.MySQLToType(mysqlType, flags)\nif err != nil {\n  log.Warn(\"unknown mysql type, defaulting to VarBinary\", slog.Any(\"error\", err))\n  typ = sqltypes.VarBinary\n}","preventionTips":["Keep Vitess current with the MySQL versions you connect to","Log the raw type byte on failure for triage","Test against MariaDB type codes separately"],"tags":["mysql-protocol","type-mapping","compatibility"],"backgroundTag":"unsupported-mysql-type","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}