vitessio/vitess · error
ErrNoTablet
ErrNoTablet
Error message
%w for keyspace %s
What it means
When fetching a keyspace's schema, FindTablets is used to select tablets for that keyspace; if the lookup fails for any reason the code (arguably over-broadly) wraps errors.ErrNoTablet with the keyspace name. It signals that no tablets could be resolved for the keyspace, so schema cannot be fetched.
Source
Thrown at go/vt/vtadmin/cluster/cluster.go:1434
}
if !opts.isBackfill && !cache.ShouldRefreshFromIncomingContext(ctx) {
schema, ok, err := schemacache.LoadOne(c.schemaCache, key, schemacache.LoadOptions{
BaseRequest: opts.BaseRequest,
AggregateSizes: opts.TableSizeOptions.AggregateSizes,
})
span.Annotate("cache_hit", ok)
if ok {
return schema, err
}
}
// Fetch all tablets for the keyspace.
tablets, err := c.FindTablets(ctx, func(tablet *vtadminpb.Tablet) bool {
return tablet.Tablet.Keyspace == keyspace
}, -1)
if err != nil {
return nil, fmt.Errorf("%w for keyspace %s", errors.ErrNoTablet, keyspace)
}
tabletsToQuery, err := c.getTabletsToQueryForSchemas(ctx, keyspace, tablets, opts)
if err != nil {
return nil, err
}
schema, err := c.getSchemaFromTablets(ctx, keyspace, tabletsToQuery, opts)
if err != nil {
return nil, err
}
go schemacache.AddOrBackfill(c.schemaCache, []*vtadminpb.Schema{schema}, key, c.cfg.SchemaCacheConfig.DefaultExpiration, schemacache.LoadOptions{
BaseRequest: opts.BaseRequest,
AggregateSizes: opts.TableSizeOptions.AggregateSizes,
})
return schema, nilView on GitHub (pinned to 01a25a7d17)
Solutions
- Verify the keyspace name is correct and exists (list keyspaces via vtctld)
- Confirm tablets exist and are registered in the topo for that keyspace
- Check the underlying FindTablets/topo error — a topo failure is masked as ErrNoTablet here
- If the keyspace is intentionally empty, treat 'no tablet' as expected and skip schema fetch
Defensive patterns
Strategy: validation
Validate before calling
// Go: confirm the keyspace exists before fetching its schema
resp, err := vtctldClient.GetKeyspace(ctx, &vtctldatapb.GetKeyspaceRequest{Keyspace: name})
if err != nil {
return fmt.Errorf("keyspace %s does not exist: %w", name, err)
} Type guard
func isNoTablet(err error) bool {
return errors.Is(err, errors.ErrNoTablet)
} Try / catch
schema, err := c.GetSchema(ctx, req)
if err != nil {
if isNoTablet(err) {
// verify keyspace name; treat empty keyspace as empty schema
}
return err
} Prevention
- Validate keyspace names against the topo before schema calls
- Check tablet registration after keyspace creation
- Remember topo failures can be masked as ErrNoTablet here
- Skip schema fetch for intentionally empty keyspaces
When it happens
Trigger: Calling GetSchema (keyspace-scoped) for a keyspace with zero tablets, a misspelled/nonexistent keyspace, or when FindTablets itself errors (topo failure) — all surface as 'ErrNoTablet for keyspace X'.
Common situations: Typo'd keyspace name in an API request; keyspace recently created but tablets not yet registered; keyspace drained/deleted while schema was being fetched; topo connectivity problems mistaken for 'no tablets'.
Related errors
- not allowed: deny-all security-policy enforced
- not allowed: read-only security-policy enforced
- opts %+v, err: %w
- invalid joined path
- invalid choice for enum
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/c253b27dc7fcd046.
Report an issue: GitHub.