{"record":{"id":"c253b27dc7fcd046","repo":"vitessio/vitess","slug":"errnotablet","errorCode":"ErrNoTablet","errorMessage":"%w for keyspace %s","messagePattern":"%w for keyspace (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtadmin/cluster/cluster.go","lineNumber":1434,"sourceCode":"\t}\n\tif !opts.isBackfill && !cache.ShouldRefreshFromIncomingContext(ctx) {\n\t\tschema, ok, err := schemacache.LoadOne(c.schemaCache, key, schemacache.LoadOptions{\n\t\t\tBaseRequest:    opts.BaseRequest,\n\t\t\tAggregateSizes: opts.TableSizeOptions.AggregateSizes,\n\t\t})\n\n\t\tspan.Annotate(\"cache_hit\", ok)\n\t\tif ok {\n\t\t\treturn schema, err\n\t\t}\n\t}\n\n\t// Fetch all tablets for the keyspace.\n\ttablets, err := c.FindTablets(ctx, func(tablet *vtadminpb.Tablet) bool {\n\t\treturn tablet.Tablet.Keyspace == keyspace\n\t}, -1)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w for keyspace %s\", errors.ErrNoTablet, keyspace)\n\t}\n\n\ttabletsToQuery, err := c.getTabletsToQueryForSchemas(ctx, keyspace, tablets, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tschema, err := c.getSchemaFromTablets(ctx, keyspace, tabletsToQuery, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgo schemacache.AddOrBackfill(c.schemaCache, []*vtadminpb.Schema{schema}, key, c.cfg.SchemaCacheConfig.DefaultExpiration, schemacache.LoadOptions{\n\t\tBaseRequest:    opts.BaseRequest,\n\t\tAggregateSizes: opts.TableSizeOptions.AggregateSizes,\n\t})\n\n\treturn schema, nil","sourceCodeStart":1416,"sourceCodeEnd":1452,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtadmin/cluster/cluster.go#L1416-L1452","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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'.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Go: confirm the keyspace exists before fetching its schema\nresp, err := vtctldClient.GetKeyspace(ctx, &vtctldatapb.GetKeyspaceRequest{Keyspace: name})\nif err != nil {\n\treturn fmt.Errorf(\"keyspace %s does not exist: %w\", name, err)\n}","typeGuard":"func isNoTablet(err error) bool {\n\treturn errors.Is(err, errors.ErrNoTablet)\n}","tryCatchPattern":"schema, err := c.GetSchema(ctx, req)\nif err != nil {\n\tif isNoTablet(err) {\n\t\t// verify keyspace name; treat empty keyspace as empty schema\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["vtadmin","topology","tablets","schema"],"backgroundTag":"no-tablet-found","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}