{"record":{"id":"0eacb9ebd070afdc","repo":"vitessio/vitess","slug":"unknown-table-v-in-schema-0eacb9","errorCode":null,"errorMessage":"unknown table %v in schema","messagePattern":"unknown table (.+?) in schema","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletserver/vstreamer/vstreamer.go","lineNumber":1054,"sourceCode":"\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())\n\t\t}\n\t\tfields = append(fields, &querypb.Field{\n\t\t\tName:    fmt.Sprintf(\"@%d\", i+1),\n\t\t\tType:    t,\n\t\t\tCharset: uint32(coll),\n\t\t\tFlags:   mysql.FlagsForColumn(t, coll),\n\t\t})\n\t}\n\tst, err := vs.se.GetTableForPos(vs.ctx, sqlparser.NewIdentifierCS(tm.Name), replication.EncodePosition(vs.pos))\n\tif err != nil {\n\t\tif vs.filter.FieldEventMode == binlogdatapb.Filter_ERR_ON_MISMATCH {\n\t\t\tlog.Info(\"No schema found for table \" + tm.Name)\n\t\t\treturn nil, fmt.Errorf(\"unknown table %v in schema\", tm.Name)\n\t\t}\n\t\treturn fields, nil\n\t}\n\n\tif len(st.Fields) < len(tm.Types) {\n\t\tif vs.filter.FieldEventMode == binlogdatapb.Filter_ERR_ON_MISMATCH {\n\t\t\tlog.Info(\"Cannot determine columns for table \" + tm.Name)\n\t\t\treturn nil, fmt.Errorf(\"cannot determine table columns for %s: event has %v, schema has %v\", tm.Name, tm.Types, st.Fields)\n\t\t}\n\t\treturn fields, nil\n\t}\n\n\t// Check if the schema returned by schema.Engine is compatible with the row.\n\t// If not then we rely on the TableMap event alone. This will prevent us from\n\t// being able to handle filters with colum names (in planbuilder.findColumn()).\n\tfor i := range tm.Types {\n\t\tif !sqltypes.AreTypesCompatible(fields[i].Type, st.Fields[i].Type) {\n\t\t\treturn fields, nil","sourceCodeStart":1036,"sourceCodeEnd":1072,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go#L1036-L1072","documentation":"While decoding a row event, vstreamer looks up the table in vttablet's schema engine at the stream's position. If the table is absent from the schema and the Filter's FieldEventMode is ERR_ON_MISMATCH, it fails instead of silently skipping the table, alerting the operator that the stream references a table the schema doesn't know.","triggerScenarios":"buildTableColumns calls vs.se.GetTableForPos and receives an error while vs.filter.FieldEventMode == binlogdatapb.Filter_ERR_ON_MISMATCH; in other modes it would just return the fields gathered so far.","commonSituations":"Streaming rows for a table that was dropped or renamed mid-stream; keyspace/shard filtering (tables outside the filter) with ERR_ON_MISMATCH configured; stale or not-yet-loaded schema in vttablet.","solutions":["Reload the vttablet schema (schema reload) so the table is visible","Change the filter FieldEventMode away from ERR_ON_MISMATCH if skipping unknown tables is acceptable","Re-create the table or restore it if the drop was unintentional","Restart the stream from a position after the table was dropped"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Before streaming, confirm the table exists in the tablet schema:\n// SHOW TABLES LIKE '<table>';  -- and ensure vttablet schema is loaded","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"unknown table\") && strings.Contains(err.Error(), \"in schema\") {\n    // either reload schema and retry, or adjust Filter.FieldEventMode to tolerate misses\n}","preventionTips":["Keep filter table lists in sync with the actual schema","Reload schema after DDL","Choose FieldEventMode deliberately per workflow"],"tags":["schema","filter","table-lookup","vstreamer"],"backgroundTag":"unknown-table-schema","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}