{"record":{"id":"5a299cd30ada559b","repo":"juicedata/juicefs","slug":"read-stage-footer-data-w","errorCode":null,"errorMessage":"read stage footer data: %w","messagePattern":"read stage footer data: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/chunk/disk_cache_file.go","lineNumber":102,"sourceCode":"\t\treturn nil\n\t}\n\tvar hdr [4]byte\n\tif _, err := cf.File.ReadAt(hdr[:], cf.footerOff); err != nil {\n\t\treturn fmt.Errorf(\"read stage footer header: %w\", err)\n\t}\n\tif magic := binary.BigEndian.Uint16(hdr[:2]); magic != stageFooterMagic {\n\t\treturn fmt.Errorf(\"invalid stage footer magic %#04x\", magic)\n\t}\n\tsize := int64(binary.BigEndian.Uint16(hdr[2:4]))\n\tif size == 0 {\n\t\treturn fmt.Errorf(\"invalid stage footer length %d\", size)\n\t}\n\tif cf.footerOff+4+size != cf.size {\n\t\treturn fmt.Errorf(\"stage footer size mismatch: offset %d, size %d, file size %d\", cf.footerOff, size, cf.size)\n\t}\n\tbuf := make([]byte, size)\n\tif _, err := cf.File.ReadAt(buf, cf.footerOff+4); err != nil {\n\t\treturn fmt.Errorf(\"read stage footer data: %w\", err)\n\t}\n\tif err := msgpack.Unmarshal(buf, f); err != nil {\n\t\treturn err\n\t}\n\tif f.Tier > maxTierID {\n\t\tf.Tier = 0 // ignore unknown/corrupted tier, fall back to the default\n\t}\n\treturn nil\n}\n\nvar (\n\tstageFooterBaseLen int\n\tstageFooterPad     [4][]byte\n\tstageFooterMagic   = uint16(0x4653)\n)\n\nfunc init() {\n\tb, err := msgpack.Marshal(&stageFooter{Pad: make([]byte, 0)})","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/chunk/disk_cache_file.go#L84-L120","documentation":"Returned by stageFooter.unmarshal when reading the footer payload bytes (tier metadata) from the staged cache file fails after the header validated. An I/O error at this point means disk trouble or concurrent truncation.","triggerScenarios":"Thrown at pkg/chunk/disk_cache_file.go:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the unreadable staged file; verify cache disk health"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}