vitessio/vitess · error
at least one table must be specified
Error message
at least one table must be specified
What it means
validateAndGetVindexInfo validates user-supplied input for CreateLookupVindex and requires at least one source table. When the "tables" input resolves to an empty list, it returns this error because a lookup vindex must be built against at least one table.
Source
Thrown at go/vt/vtctl/workflow/lookup_vindex.go:354
ignoreNulls := false
if ignoreNullsStr, ok := vindex.Params["ignore_nulls"]; ok {
// This mirrors the behavior of vindexes.boolFromMap().
switch ignoreNullsStr {
case "true":
ignoreNulls = true
case "false":
ignoreNulls = false
default:
return nil,
vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "ignore_nulls (%s) value must be 'true' or 'false'",
ignoreNullsStr)
}
}
// Validate input table.
if len(tables) < 1 {
return nil, errors.New("at least one table must be specified")
}
return &vindexInfo{
name: vindexName,
targetKeyspace: targetKeyspace,
targetTableName: targetTableName,
fromCols: vindexFromCols,
toCol: vindexToCol,
ignoreNulls: ignoreNulls,
}, nil
}
func (lv *lookupVindex) getTargetAndSourceVSchema(ctx context.Context, sourceKeyspace, targetKeyspace string) (sourceVSchema, targetVSchema *topo.KeyspaceVSchemaInfo, err error) {
sourceVSchema, err = lv.ts.GetVSchema(ctx, sourceKeyspace)
if err != nil {
return nil, nil, err
}
if sourceVSchema.Vindexes == nil {View on GitHub (pinned to 01a25a7d17)
Solutions
- Include at least one table in the vindex spec's tables before creating the lookup vindex
- Verify the vschema JSON file is non-empty and well-formed
- Check shell/script variables that supply table names aren't empty
Example fix
// before
{"vindexes": {"lv": {"type": "consistent_lookup_unique"}}} // no tables
// after
{"vindexes": {"lv": {"type": "consistent_lookup_unique"}}, "tables": {"user": {"column_vindexes": [{"column": "id", "name": "lv"}]}}} Defensive patterns
Strategy: validation
Validate before calling
if len(tables) == 0 {
return fmt.Errorf("CreateLookupVindex requires at least one table in the spec")
} Type guard
func hasTables(tables []string) bool { return len(tables) > 0 } Try / catch
if err := createLookupVindex(...); err != nil {
if strings.Contains(err.Error(), "at least one table must be specified") {
return fmt.Errorf("check the tables argument/vschema JSON: %w", err)
}
return err
} Prevention
- Validate the vschema JSON is non-empty and parses before invoking
- Assert table-name shell variables are non-empty
- Include at least one table entry in every vindex spec
When it happens
Trigger: Invoking CreateLookupVindex (via vtctldclient or workflow package) with a table spec that yields zero tables — e.g. omitting the tables argument, passing an empty object/array, or a spec the parser resolves to no tables.
Common situations: Empty or malformed vschema JSON file passed on the command line; script variable holding table names expanding to empty; forgetting the table key in the Vindex spec.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- one or two tables must be specified
- vindex is in write-only mode
- vindex has no owner
- no sharded vschema was provided, so you will need to update
- cannot build vschema for keyspace %v: %v
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/d392ea88425e06e9.
Report an issue: GitHub.