{"record":{"id":"830259366adbada2","repo":"weaviate/weaviate","slug":"unable-to-retrieve-shards-for-class-s","errorCode":null,"errorMessage":"unable to retrieve shards for class %s","messagePattern":"unable to retrieve shards for class (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/schema/migrate/fs/file_structure_migration.go","lineNumber":174,"sourceCode":"}\n\ntype schemaReader interface {\n\tShards(class string) ([]string, error)\n\tReadOnlySchema() models.Schema\n}\n\nfunc newFileMatcher(schemaReader schemaReader, rootPath string) (*fileMatcher, error) {\n\tshardLsmDirs := make(map[string]*classShard)\n\tshardFilePrefixes := make(map[string]*classShard)\n\tshardGeoDirPrefixes := make(map[string]*classShardGeoProp)\n\tclasses := make(map[string][]*classShard)\n\n\tschema := schemaReader.ReadOnlySchema()\n\tfor _, class := range schema.Classes {\n\t\tclassName := class.Class\n\t\tshards, err := schemaReader.Shards(className)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to retrieve shards for class %s\", className)\n\t\t}\n\t\tlowercasedClass := strings.ToLower(class.Class)\n\n\t\tvar geoProps []string\n\t\tfor _, prop := range class.Properties {\n\t\t\tif dt, ok := entschema.AsPrimitive(prop.DataType); ok && dt == entschema.DataTypeGeoCoordinates {\n\t\t\t\tgeoProps = append(geoProps, prop.Name)\n\t\t\t}\n\t\t}\n\n\t\tclasses[class.Class] = make([]*classShard, 0, len(shards))\n\t\tfor _, shard := range shards {\n\t\t\tcs := &classShard{class: class.Class, shard: shard}\n\t\t\tshardLsmDirs[fmt.Sprintf(\"%s_%s_lsm\", lowercasedClass, shard)] = cs\n\t\t\tshardFilePrefixes[fmt.Sprintf(\"%s_%s\", lowercasedClass, shard)] = cs\n\t\t\tclasses[class.Class] = append(classes[class.Class], cs)\n\n\t\t\tfor _, geoProp := range geoProps {","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/schema/migrate/fs/file_structure_migration.go#L156-L192","documentation":"newFileMatcher lists each class's shards via schemaReader.Shards(className); failure here is reported with this (unwrapped) message. Note the underlying error is not chained, so logs will show only that shards for the class could not be retrieved.","triggerScenarios":"MigrateToHierarchicalFS starting while the schema manager cannot answer Shards() for a class found in ReadOnlySchema — schema store read failure or class metadata inconsistency.","commonSituations":"Corrupted schema store files in the data directory; class present in schema but shard metadata missing after a crash; migration running before schema load completed.","solutions":["Inspect the weaviate logs preceding this error for the underlying schema read failure","Verify the schema files in the data directory are not corrupt (compare with backup)","Restart weaviate to re-attempt schema load before migration","Remove the broken class from the schema or restore schema from backup"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// ensure the schema loads and Shards() works for every class before enabling migration","typeGuard":null,"tryCatchPattern":"if err := migrate(); err != nil {\n  if strings.Contains(err.Error(), \"unable to retrieve shards for class\") {\n    // restore schema from backup and restart\n  }\n}","preventionTips":["Verify schema integrity after crashes before migrating","Keep backups of the schema store files","Restart weaviate cleanly once before re-attempting migration"],"tags":["go","schema","migration"],"backgroundTag":"schema-read-failed","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"}