juicedata/juicefs · error

DumpMeta error: %v

Error message

DumpMeta error: %v

What it means

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.

Source

Thrown at pkg/meta/tkv.go:3927

		if i != len(entries)-1 {
			bwWrite(",")
		}
		if showProgress != nil {
			showProgress(0, 1)
		}
	}
	bwWrite(fmt.Sprintf("\n%s}\n%s}", strings.Repeat(jsonIndent, depth+1), strings.Repeat(jsonIndent, depth)))
	return nil
}

func (m *kvMeta) DumpMeta(w io.Writer, root Ino, threads int, keepSecret, fast, skipTrash bool) (err error) {
	defer func() {
		if p := recover(); p != nil {
			debug.PrintStack()
			if e, ok := p.(error); ok {
				err = e
			} else {
				err = errors.Errorf("DumpMeta error: %v", p)
			}
		}
	}()
	ctx := Background()
	var (
		lastChangelog int64
		changeLogs    []*DumpedChangeLog
	)
	if m.getFormat().ChangeLog {
		err = m.client.txn(ctx, func(tx *kvTxn) error {
			maxKey := m.findLastLogKey(tx)
			if maxKey == 0 {
				return nil
			}
			beginID := m.client.rewind(maxKey, 1)
			m.scanLogRange(tx, beginID, maxKey+1, false, func(id uint64, k, v []byte) bool {
				changeLogs = append(changeLogs, &DumpedChangeLog{
					Version: int64(id),

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. 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.
  2. 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.
  3. 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).
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: check metadata integrity
// juicefs fsck <meta-url>

Try / catch

if err := dumpMeta(...); err != nil {
    var perr interface{ PanicValue() string } // DumpMeta wraps panics as plain errors
    if strings.HasPrefix(err.Error(), "DumpMeta error:") {
        // grab debug.PrintStack output from logs, fsck the volume, retry
    }
}

Prevention

When it happens

Trigger: 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.)

Common situations: 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.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/27ecd28b55e3dc54. Report an issue: GitHub.