{"record":{"id":"d2595a58ff076950","repo":"weaviate/weaviate","slug":"index-for-collection-q-not-found","errorCode":null,"errorMessage":"index for collection %q not found","messagePattern":"index for collection %q not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"adapters/repos/db/drop_vector_index_wiring.go","lineNumber":39,"sourceCode":"\t\"github.com/weaviate/weaviate/adapters/repos/db/helpers\"\n\t\"github.com/weaviate/weaviate/entities/models\"\n\t\"github.com/weaviate/weaviate/entities/modelsext\"\n\tentschema \"github.com/weaviate/weaviate/entities/schema\"\n\t\"github.com/weaviate/weaviate/usecases/schema\"\n)\n\n// EditOpBucketsForShards resolves the edit-ops objects buckets for the given\n// local shards by direct map lookup — O(requested), not O(collection) — so a\n// bounded round on a huge MT collection does not pay a full shard-map walk. A\n// shard absent from the result is not locally available (a deactivated\n// tenant, or a lazy shard that failed to load). Lazy shards are loaded\n// explicitly with the error surfaced — never via Store()'s panicking mustLoad\n// — acceptable for a drop, a rare operator-initiated action that must touch\n// every shard once anyway.\nfunc (db *DB) EditOpBucketsForShards(ctx context.Context, collection string, shardNames []string) (map[string]editOpBucket, error) {\n\tidx := db.GetIndex(entschema.ClassName(collection))\n\tif idx == nil {\n\t\treturn nil, fmt.Errorf(\"index for collection %q not found\", collection)\n\t}\n\tbuckets := make(map[string]editOpBucket, len(shardNames))\n\tfor _, name := range shardNames {\n\t\ts := idx.shards.Load(name)\n\t\tif s == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif lazy, ok := s.(*LazyLoadShard); ok {\n\t\t\tif err := lazy.Load(ctx); err != nil {\n\t\t\t\tdb.logger.WithField(\"collection\", collection).WithField(\"shard\", name).\n\t\t\t\t\tWarnf(\"drop-vector: load lazy shard: %v\", err)\n\t\t\t\tcontinue // absent from result; the unit fails instead of panicking\n\t\t\t}\n\t\t}\n\t\tif b := s.Store().Bucket(helpers.ObjectsBucketLSM); b != nil {\n\t\t\tbuckets[name] = b\n\t\t}\n\t}","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/repos/db/drop_vector_index_wiring.go#L21-L57","documentation":"EditOpBucketsForShards fails when a requested shard cannot be found in the shard map at all — not merely unloaded, but absent (deactivated tenant removed, lazy shard not present locally). Callers treat this as 'some shards not locally available' and defer work for those shards to later sweeps.","triggerScenarios":"Thrown at adapters/repos/db/drop_vector_index_wiring.go:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat missing shards as deferred work — the periodic cleanup sweep retries on next load","Activate the tenant/shard if its edit op must be deleted immediately","Verify the shard name and collection state in the schema"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}