{"record":{"id":"62e5e1bc37a2c945","repo":"vitessio/vitess","slug":"vt13001-62e5e1","errorCode":"VT13001","errorMessage":"did not expect this method to be called","messagePattern":"did not expect this method to be called","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtgate/planbuilder/operators/table.go","lineNumber":74,"sourceCode":"\t\tColumns: columns,\n\t}\n}\n\n// Introduces implements the PhysicalOperator interface\nfunc (to *Table) introducesTableID() semantics.TableSet {\n\tif to.QTable == nil {\n\t\treturn semantics.EmptyTableSet()\n\t}\n\treturn to.QTable.ID\n}\n\n// AddPredicate implements the PhysicalOperator interface\nfunc (to *Table) AddPredicate(_ *plancontext.PlanningContext, expr sqlparser.Expr) Operator {\n\treturn newFilter(to, expr)\n}\n\nfunc (to *Table) AddColumn(*plancontext.PlanningContext, bool, bool, *sqlparser.AliasedExpr) int {\n\tpanic(vterrors.VT13001(\"did not expect this method to be called\"))\n}\n\nfunc (*Table) AddWSColumn(*plancontext.PlanningContext, int, bool) int {\n\tpanic(vterrors.VT13001(\"did not expect this method to be called\"))\n}\n\nfunc (to *Table) FindCol(ctx *plancontext.PlanningContext, expr sqlparser.Expr, underRoute bool) int {\n\tcolToFind, ok := expr.(*sqlparser.ColName)\n\tif !ok {\n\t\treturn -1\n\t}\n\n\tfor idx, colName := range to.Columns {\n\t\tif colName.Name.Equal(colToFind.Name) {\n\t\t\treturn idx\n\t\t}\n\t}\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtgate/planbuilder/operators/table.go#L56-L92","documentation":"VT13001 signals an internal planner programming error: a method was invoked on an operator that explicitly does not support it. Here, Table.AddColumn was called, but a Table operator derives its columns directly from the underlying table and never accepts columns added through the operator-column API; such additions are only valid on derived/derived-table-like operators. The panic exists to catch planner bugs early, since silently ignoring the call would produce a broken plan.","triggerScenarios":"Calling Table.AddColumn(ctx, _, _, *sqlparser.AliasedExpr) directly, or the planner's generic column-pushdown path reaching a Table operator because an outer operator (e.g. a join or derived table) delegated AddColumn to a source that is a plain Table instead of handling column materialization itself.","commonSituations":"Hitting this while extending the Vitess planbuilder (adding a new operator, join algorithm, or aggregation path) and routing column additions down to a Table source; also seen when porting queries that previously worked through older pushdown code paths to the newer operator-based planner.","solutions":["Fix the caller so AddColumn is not invoked on a Table; column additions against a table should go through AddPredicate (which wraps it in a Filter) or the caller must materialize the column in an enclosing operator.","Check which operator delegated the call (stack trace) and ensure derived/outer operators implement AddColumn themselves rather than forwarding to Table.","If you control the query, rewrite it so the extra column is produced by a derived table or select expression instead of relying on planner pushdown.","If it reproduces on a stock Vitess version with an ordinary query, file a bug with the query and stack trace — it is a planner defect."],"exampleFix":"// before: pushing a column into a Table operator\nidx := tableOp.AddColumn(ctx, false, false, aliasedExpr)\n\n// after: express it as a predicate/filter or use the enclosing operator\nnewOp := tableOp.AddPredicate(ctx, aliasedExpr.Expr)","handlingStrategy":"validation","validationCode":"_, isTable := op.(*operators.Table)\nif isTable {\n    // route the column through AddPredicate or an enclosing operator instead\n    return\n}","typeGuard":"func isColumnCapable(op operators.Operator) bool {\n    switch op.(type) {\n    case *operators.Table, *operators.Vindex:\n        return false\n    }\n    return true\n}","tryCatchPattern":"// planner panics are unrecoverable programming errors; do not try/catch.\n// Guard before calling:\nif t, ok := op.(*operators.Table); ok {\n    return t.AddPredicate(ctx, aliasedExpr.Expr)\n}\nidx := op.AddColumn(ctx, _, _, aliasedExpr)","preventionTips":["Never call AddColumn/AddWSColumn directly on a Table or Vindex operator.","When adding operators, implement or guard the Operator interface column methods explicitly for each concrete type.","Cover new planner code paths with unit tests exercising column pushdown onto every operator kind."],"tags":["planbuilder","internal-error","go","operators"],"backgroundTag":"unsupported-operator-method","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}