vitessio/vitess · error

cannot determine table columns for %s: event has %v, schema

Error message

cannot determine table columns for %s: event has %v, schema has %v

What it means

When building the row-decode plan for a sidecar (internal _vt style) table, vstreamer compares the column types embedded in the ROWS event's TableMap with the fields fetched from the live schema. If the schema query returns fewer fields than the event declares, the columns cannot be reconciled and the plan build fails.

Source

Thrown at go/vt/vttablet/tabletserver/vstreamer/vstreamer.go:938

		found := slices.Contains(vs.options.InternalTables, tableName)
		if !found {
			return nil, nil
		}
	}

	conn, err := vs.cp.Connect(vs.ctx)
	if err != nil {
		return nil, err
	}
	defer conn.Close()
	qr, err := conn.ExecuteFetch(sqlparser.BuildParsedQuery("select * from %s.%s where 1 != 1",
		sidecar.GetIdentifier(), tableName).Query, 1, true)
	if err != nil {
		return nil, err
	}
	fields := qr.Fields
	if len(fields) < len(tm.Types) {
		return nil, fmt.Errorf("cannot determine table columns for %s: event has %v, schema has %v", tm.Name, tm.Types, fields)
	}
	table := &Table{
		Name:   tableName,
		Fields: fields[:len(tm.Types)],
	}

	// Build a normal table plan, which means, return all rows
	// and columns as is. Special handling may be done when we actually
	// receive the row event, example: we'll build a JOURNAL or VERSION event instead.
	plan, err := buildREPlan(vs.se.Environment(), table, nil, "")
	if err != nil {
		return nil, err
	}
	plan.IsInternal = true
	vs.plans[id] = &streamerPlan{
		Plan:     plan,
		TableMap: tm,
	}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Reload the table schema in vttablet so the schema engine matches the current table definition
  2. Ensure the sidecar table schema matches the version writing the binlog events (complete any pending schema migrations)
  3. Restart the vstream/vreplication workflow from a position after the schema change
  4. Verify no concurrent DDL on the sidecar table during streaming
Defensive patterns

Strategy: retry

Validate before calling

// Compare live schema vs event expectation:
// SELECT COUNT(*) FROM information_schema.columns WHERE table_schema='_vt' AND table_name='<sidecar_table>';

Try / catch

if strings.Contains(err.Error(), "cannot determine table columns") {
    // trigger vttablet schema reload, then retry the vstream
}

Prevention

When it happens

Trigger: buildSidecarTablePlan executes the schema query for the sidecar table, gets qr.Fields shorter than tm.Types (the column count declared by the binlog TableMap event), and errors out.

Common situations: Schema drift between the binlog stream (older or newer table definition) and the current sidecar table schema; an online schema change of a _vt table while vreplication is streaming; stale schema cache in vttablet.

Related errors


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