{"record":{"id":"af7ebc02a88f9ac9","repo":"vitessio/vitess","slug":"vt13001-af7ebc","errorCode":"VT13001","errorMessage":"tried to add group by to a table","messagePattern":"tried to add group by to a table","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtgate/planbuilder/operators/vindex.go","lineNumber":66,"sourceCode":"\t}\n)\n\nconst wrongWhereCond = \"WHERE clause for vindex function must be of the form id = <val> or id in(<val>,...)\"\n\n// Introduces implements the Operator interface\nfunc (v *Vindex) introducesTableID() semantics.TableSet {\n\treturn v.Solved\n}\n\n// Clone implements the Operator interface\nfunc (v *Vindex) Clone([]Operator) Operator {\n\tclone := *v\n\treturn &clone\n}\n\nfunc (v *Vindex) AddColumn(ctx *plancontext.PlanningContext, reuse bool, gb bool, ae *sqlparser.AliasedExpr) int {\n\tif gb {\n\t\tpanic(vterrors.VT13001(\"tried to add group by to a table\"))\n\t}\n\tif reuse {\n\t\toffset := v.FindCol(ctx, ae.Expr, true)\n\t\tif offset > -1 {\n\t\t\treturn offset\n\t\t}\n\t}\n\n\treturn addColumn(ctx, v, ae.Expr)\n}\n\nfunc (*Vindex) AddWSColumn(*plancontext.PlanningContext, int, bool) int {\n\tpanic(vterrors.VT13001(\"did not expect this method to be called\"))\n}\n\nfunc colNameToExpr(c *sqlparser.ColName) *sqlparser.AliasedExpr {\n\treturn &sqlparser.AliasedExpr{\n\t\tExpr: c,","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtgate/planbuilder/operators/vindex.go#L48-L84","documentation":"Internal planbuilder error: an attempt was made to add a GROUP BY to an operator representing a plain table, which does not support grouping. Thrown at go/vt/vtgate/planbuilder/operators/vindex.go:66.","triggerScenarios":"pushProjectionInVindex calls Vindex.AddColumn with gb=true (group-by requested) on a Vindex operator — a planner bug scenario, not something a query can legitimately request.","commonSituations":"Internal planner edge case; queries combining vindex-only routing with GROUP BY that expose an unhandled path; typically a Vitess bug.","solutions":["File a Vitess bug with the offending query and schema","Simplify the query (avoid GROUP BY over the vindex-derived projection) as a workaround","Update to the latest Vitess release where the planner path may be fixed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// internal invariant violation; guard with recover and report\ndefer func() {\n    if r := recover(); r != nil {\n        log.Printf(\"VT13001 planner panic: %v (query=%s)\", r, query)\n    }\n}()","preventionTips":["Report the triggering query upstream as a planner bug","Upgrade to the latest Vitess patch release","Avoid unusual GROUP BY shapes over vindex-routed single-table plans until fixed"],"tags":["vitess","vtgate","planbuilder","internal-error","group-by"],"backgroundTag":"planner-invariant-violation","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}