juicedata/juicefs · error

invalid dumped meta

Error message

invalid dumped meta

What it means

Returned by DumpedMeta.writeJsonWithOutTree in pkg/meta/dump.go when the dump still contains a FSTree or Trash section, which this writer refuses to serialize. writeJsonWithOutTree is used for compact/filtered dumps that must not include the full tree; its presence indicates a misuse of the API.

Source

Thrown at pkg/meta/dump.go:356

	DelFiles    []*DumpedDelFile
	Quotas      map[Ino]*DumpedQuota    `json:",omitempty"`
	UserQuotas  map[uint64]*DumpedQuota `json:",omitempty"`
	GroupQuotas map[uint64]*DumpedQuota `json:",omitempty"`
	ChangeLog   []*DumpedChangeLog      `json:",omitempty"`
	FSTree      *DumpedEntry            `json:",omitempty"`
	Trash       *DumpedEntry            `json:",omitempty"`
}

func (dm *DumpedMeta) validate() error {
	if dm.Counters == nil {
		return errors.New("invalid dumped meta: missing 'Counters'")
	}
	return nil
}

func (dm *DumpedMeta) writeJsonWithOutTree(w io.Writer) (*bufio.Writer, error) {
	if dm.FSTree != nil || dm.Trash != nil {
		return nil, fmt.Errorf("invalid dumped meta")
	}
	data, err := json.MarshalIndent(dm, "", jsonIndent)
	if err != nil {
		return nil, err
	}
	bw := bufio.NewWriterSize(w, jsonWriteSize)
	if _, err = bw.Write(append(data[:len(data)-2], ',')); err != nil { // delete \n}
		return nil, err
	}
	return bw, nil
}

func (m *baseMeta) loadDumpedQuotas(ctx Context, dm *DumpedMeta) {
	for inode, q := range dm.Quotas {
		if _, err := m.en.doSetQuota(ctx, DirQuotaType, uint64(inode), &Quota{q.MaxSpace, q.MaxInodes, q.UsedSpace, q.UsedInodes, 0, 0}); err != nil {
			logger.Warnf("set dir quota (inode=%d): %s", inode, err)
		}
	}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Use the full dump writer (writeJson) when FSTree/Trash data is present
  2. Clear FSTree and Trash on the DumpedMeta if a settings-only export is truly intended
  3. Check which dump command/API populated the structure and match the writer to it
Defensive patterns

Strategy: type-guard

Validate before calling

// before calling writeJsonWithOutTree
if dm.FSTree != nil || dm.Trash != nil { /* use the full writer instead */ }

Type guard

func isSettingsOnly(dm *DumpedMeta) bool { return dm.FSTree == nil && dm.Trash == nil }

Prevention

When it happens

Trigger: Calling writeJsonWithOutTree on a DumpedMeta that was populated by a full `juicefs dump` (FSTree or Trash non-nil) instead of a settings-only dump.

Common situations: Programmatic use of the meta dump API to export only settings while the loaded dump object includes the tree; mixing full-dump and settings-only output paths.

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/4511eefbb8d4ff1e. Report an issue: GitHub.