{"record":{"id":"6071d21309f5c305","repo":"vitessio/vitess","slug":"unsupported-type-d-position-d","errorCode":null,"errorMessage":"unsupported type: %d, position: %d","messagePattern":"unsupported type: (.+?), position: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletserver/vstreamer/vstreamer.go","lineNumber":1023,"sourceCode":"\t\tFieldEvent: &binlogdatapb.FieldEvent{\n\t\t\tTableName: plan.Table.Name,\n\t\t\tFields:    plan.fields(),\n\t\t\tKeyspace:  vs.vse.keyspace,\n\t\t\tShard:     vs.vse.shard,\n\t\t\t// This mapping will be done, if needed, in the vstreamer when we process\n\t\t\t// and build ROW events.\n\t\t\tEnumSetStringValues: len(plan.EnumSetValuesMap) > 0,\n\t\t},\n\t}, nil\n}\n\nfunc (vs *vstreamer) buildTableColumns(tm *mysql.TableMap) ([]*querypb.Field, error) {\n\tvar fields []*querypb.Field\n\tvar txtFieldIdx int\n\tfor i, typ := range tm.Types {\n\t\tt, err := sqltypes.MySQLToType(typ, 0)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unsupported type: %d, position: %d\", typ, i)\n\t\t}\n\t\t// Use the collation inherited or the one specified explicitly for the\n\t\t// column if one was provided in the event's optional metadata (MySQL only\n\t\t// provides this for text based columns).\n\t\tvar coll collations.ID\n\t\tswitch {\n\t\tcase sqltypes.IsText(t) && len(tm.ColumnCollationIDs) > txtFieldIdx:\n\t\t\tcoll = tm.ColumnCollationIDs[txtFieldIdx]\n\t\t\ttxtFieldIdx++\n\t\tcase t == sqltypes.TypeJSON:\n\t\t\t// JSON is a blob at this (storage) layer -- vs the connection/query serving\n\t\t\t// layer which CollationForType seems primarily concerned about and JSON at\n\t\t\t// the response layer should be using utf-8 as that's the standard -- so we\n\t\t\t// should NOT use utf8mb4 as the collation in MySQL for a JSON column is\n\t\t\t// NULL, meaning there is not one (same as for int) and we should use binary.\n\t\t\tcoll = collations.CollationBinaryID\n\t\tdefault: // Use the server defined default for the column's type\n\t\t\tcoll = collations.CollationForType(t, vs.se.Environment().CollationEnv().DefaultConnectionCharset())","sourceCodeStart":1005,"sourceCodeEnd":1041,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go#L1005-L1041","documentation":"vstreamer maps each MySQL column type code from the binlog TableMap event to a Vitess sqltypes type. When MySQLToType cannot translate a numeric type code, the column cannot be decoded and the table plan build fails. This guards against decoding rows with types Vitess does not understand.","triggerScenarios":"buildTableColumns iterates tm.Types; sqltypes.MySQLToType(typ, 0) returns an error for a type code at position i, producing this error with the code and column position.","commonSituations":"Replicating from a newer MySQL/MariaDB that introduced a column type the running Vitess doesn't know; corrupted TableMap type arrays; exotic column types or plugins.","solutions":["Upgrade Vitess to a version that supports the column type reported in the error","Check the source server version and whether the column uses a new/unusual type","Reproduce the type with SHOW CREATE TABLE and consider altering the column to a supported type","Validate the binlog file with mysqlbinlog to rule out corruption"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Check source version vs Vitess support matrix before replicating:\n// SELECT VERSION(); -- confirm all column types in tables are supported by your Vitess version","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"unsupported type:\") {\n    // parse code/position from the error, map to the column via SHOW CREATE TABLE, plan an upgrade or ALTER\n}","preventionTips":["Pin Vitess version to support the MySQL version in use","Review new column types before adopting server upgrades","Test replication after major MySQL upgrades"],"tags":["binlog","type-mapping","columns","vstreamer"],"backgroundTag":"unsupported-column-type","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}