{"record":{"id":"77c87e6db74d7968","repo":"juicedata/juicefs","slug":"the-entry-of-the-root-inode-was-not-found","errorCode":null,"errorMessage":"The entry of the root inode was not found","messagePattern":"The entry of the root inode was not found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"pkg/meta/sql.go","lineNumber":4977,"sourceCode":"\t\t\t}\n\t\t\tif err = m.dumpEntry(s, root, TypeDirectory, tree, nil); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif root == RootInode && !skipTrash {\n\t\t\t\ttrash = &DumpedEntry{\n\t\t\t\t\tName: \"Trash\",\n\t\t\t\t\tAttr: &DumpedAttr{\n\t\t\t\t\t\tInode: TrashInode,\n\t\t\t\t\t\tType:  typeToString(TypeDirectory),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tif err = m.dumpEntry(s, TrashInode, TypeDirectory, trash, nil); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif tree == nil {\n\t\t\treturn errors.New(\"The entry of the root inode was not found\")\n\t\t}\n\t\ttree.Name = \"FSTree\"\n\n\t\tvar drows []delfile\n\t\t// the statement remembers the table of last Iterator\n\t\tif err := s.Table(&delfile{}).Find(&drows); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdels := make([]*DumpedDelFile, 0, len(drows))\n\t\tfor _, row := range drows {\n\t\t\tdels = append(dels, &DumpedDelFile{row.Inode, row.Length, row.Expire})\n\t\t}\n\t\tvar crows []counter\n\t\tif err = s.Find(&crows); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcounters := &DumpedCounters{}\n\t\tfor _, row := range crows {","sourceCodeStart":4959,"sourceCodeEnd":4995,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/sql.go#L4959-L4995","documentation":"During SQL metadata dump, the root inode (1) entry must be present to anchor the FSTree; if no row was found for the root inode, the dump is incomplete and this error aborts it. It protects against emitting a dump with a missing filesystem root.","triggerScenarios":"Running `juicefs dump` against a SQL metadata engine whose jfs_entry table has no row for inode 1 (root) — e.g. severely corrupted or wrongly-initialized metadata.","commonSituations":"Pointing dump at the wrong/empty database schema; metadata corruption or manual deletion of the root row; restoring a broken backup into SQL then dumping it.","solutions":["Verify you are dumping the intended volume (correct MySQL/Postgres/SQLite DSN and table prefix).","Check the jfs_entry table for the row with inode=1; restore the root entry from a good backup if it is missing.","If metadata is corrupted, restore the SQL database from a backup (juicefs backup output) before dumping."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before dumping, verify root entry exists\nvar n int64\ndb.Model(&entry{}).Where(\"inode = 1\").Count(&n)\nif n == 0 { return errors.New(\"root inode missing; restore from backup first\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm the DSN points at the intended volume database","Keep regular `juicefs backup` snapshots","Never manually delete rows from jfs_entry"],"tags":["metadata","sql","dump"],"backgroundTag":"record-not-found","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}