{"record":{"id":"4511eefbb8d4ff1e","repo":"juicedata/juicefs","slug":"invalid-dumped-meta","errorCode":null,"errorMessage":"invalid dumped meta","messagePattern":"invalid dumped meta","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/dump.go","lineNumber":356,"sourceCode":"\tDelFiles    []*DumpedDelFile\n\tQuotas      map[Ino]*DumpedQuota    `json:\",omitempty\"`\n\tUserQuotas  map[uint64]*DumpedQuota `json:\",omitempty\"`\n\tGroupQuotas map[uint64]*DumpedQuota `json:\",omitempty\"`\n\tChangeLog   []*DumpedChangeLog      `json:\",omitempty\"`\n\tFSTree      *DumpedEntry            `json:\",omitempty\"`\n\tTrash       *DumpedEntry            `json:\",omitempty\"`\n}\n\nfunc (dm *DumpedMeta) validate() error {\n\tif dm.Counters == nil {\n\t\treturn errors.New(\"invalid dumped meta: missing 'Counters'\")\n\t}\n\treturn nil\n}\n\nfunc (dm *DumpedMeta) writeJsonWithOutTree(w io.Writer) (*bufio.Writer, error) {\n\tif dm.FSTree != nil || dm.Trash != nil {\n\t\treturn nil, fmt.Errorf(\"invalid dumped meta\")\n\t}\n\tdata, err := json.MarshalIndent(dm, \"\", jsonIndent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbw := bufio.NewWriterSize(w, jsonWriteSize)\n\tif _, err = bw.Write(append(data[:len(data)-2], ',')); err != nil { // delete \\n}\n\t\treturn nil, err\n\t}\n\treturn bw, nil\n}\n\nfunc (m *baseMeta) loadDumpedQuotas(ctx Context, dm *DumpedMeta) {\n\tfor inode, q := range dm.Quotas {\n\t\tif _, err := m.en.doSetQuota(ctx, DirQuotaType, uint64(inode), &Quota{q.MaxSpace, q.MaxInodes, q.UsedSpace, q.UsedInodes, 0, 0}); err != nil {\n\t\t\tlogger.Warnf(\"set dir quota (inode=%d): %s\", inode, err)\n\t\t}\n\t}","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/dump.go#L338-L374","documentation":"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.","triggerScenarios":"Calling writeJsonWithOutTree on a DumpedMeta that was populated by a full `juicefs dump` (FSTree or Trash non-nil) instead of a settings-only dump.","commonSituations":"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.","solutions":["Use the full dump writer (writeJson) when FSTree/Trash data is present","Clear FSTree and Trash on the DumpedMeta if a settings-only export is truly intended","Check which dump command/API populated the structure and match the writer to it"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// before calling writeJsonWithOutTree\nif dm.FSTree != nil || dm.Trash != nil { /* use the full writer instead */ }","typeGuard":"func isSettingsOnly(dm *DumpedMeta) bool { return dm.FSTree == nil && dm.Trash == nil }","tryCatchPattern":null,"preventionTips":["Match the dump writer to how the DumpedMeta was populated","Only use the no-tree writer for settings-only exports"],"tags":["dump","json","internal-invariant"],"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"}