{"record":{"id":"27ecd28b55e3dc54","repo":"juicedata/juicefs","slug":"dumpmeta-error-v-27ecd2","errorCode":null,"errorMessage":"DumpMeta error: %v","messagePattern":"DumpMeta error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/tkv.go","lineNumber":3927,"sourceCode":"\t\tif i != len(entries)-1 {\n\t\t\tbwWrite(\",\")\n\t\t}\n\t\tif showProgress != nil {\n\t\t\tshowProgress(0, 1)\n\t\t}\n\t}\n\tbwWrite(fmt.Sprintf(\"\\n%s}\\n%s}\", strings.Repeat(jsonIndent, depth+1), strings.Repeat(jsonIndent, depth)))\n\treturn nil\n}\n\nfunc (m *kvMeta) DumpMeta(w io.Writer, root Ino, threads int, keepSecret, fast, skipTrash bool) (err error) {\n\tdefer func() {\n\t\tif p := recover(); p != nil {\n\t\t\tdebug.PrintStack()\n\t\t\tif e, ok := p.(error); ok {\n\t\t\t\terr = e\n\t\t\t} else {\n\t\t\t\terr = errors.Errorf(\"DumpMeta error: %v\", p)\n\t\t\t}\n\t\t}\n\t}()\n\tctx := Background()\n\tvar (\n\t\tlastChangelog int64\n\t\tchangeLogs    []*DumpedChangeLog\n\t)\n\tif m.getFormat().ChangeLog {\n\t\terr = m.client.txn(ctx, func(tx *kvTxn) error {\n\t\t\tmaxKey := m.findLastLogKey(tx)\n\t\t\tif maxKey == 0 {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tbeginID := m.client.rewind(maxKey, 1)\n\t\t\tm.scanLogRange(tx, beginID, maxKey+1, false, func(id uint64, k, v []byte) bool {\n\t\t\t\tchangeLogs = append(changeLogs, &DumpedChangeLog{\n\t\t\t\t\tVersion: int64(id),","sourceCodeStart":3909,"sourceCodeEnd":3945,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/tkv.go#L3909-L3945","documentation":"kvMeta.DumpMeta (pkg/meta/tkv.go:3927) installs a recover() guard: any panic during a metadata dump on a KV engine is converted into the returned error \"DumpMeta error: %v\" (unless the panic value is already an error). It is a last-resort wrapper so `juicefs dump` fails with a message instead of crashing the process.","triggerScenarios":"Running `juicefs dump` on a TiKV/etcd/Badger/FDB volume when dump internals panic: nil attribute/marshal assumptions on corrupt records, unexpected key layouts from older versions, or bugs in dumpDirFast/scan callbacks. (Note: the cmd/bench.go usages shown are unrelated local `err` variables, not this error.)","commonSituations":"Dumping a volume produced by a much older or newer JuiceFS version whose key encoding differs; corrupted metadata keys inserted manually or by a bug; dumping while another process mutates the same key range in an unexpected way.","solutions":["Read the panic value in the message and the printed stack trace (debug.PrintStack output in the client log) to locate the failing dump path.","Verify all clients are on a consistent JuiceFS version and retry the dump; try `juicefs dump --fast` or `--skip-trash` to route around the offending section.","Run `juicefs fsck` to detect corrupted metadata records; if a specific key/record is corrupt, restore from a metadata backup (`juicefs dump` of an earlier good state)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-flight: check metadata integrity\n// juicefs fsck <meta-url>","typeGuard":null,"tryCatchPattern":"if err := dumpMeta(...); err != nil {\n    var perr interface{ PanicValue() string } // DumpMeta wraps panics as plain errors\n    if strings.HasPrefix(err.Error(), \"DumpMeta error:\") {\n        // grab debug.PrintStack output from logs, fsck the volume, retry\n    }\n}","preventionTips":["Keep all client versions consistent; never mix very old/new JuiceFS against the same volume.","Run `juicefs fsck` periodically to catch corrupt metadata before dumps.","Schedule dumps from metadata backups to reduce exposure to live-mutation races."],"tags":["go","dump","panic","kv","recovery"],"backgroundTag":"internal-invariant-violation","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"}