{"record":{"id":"d910e51d21a9960a","repo":"juicedata/juicefs","slug":"checksums-of-copied-object-s-don-t-match","errorCode":null,"errorMessage":"checksums of copied object %s don't match","messagePattern":"checksums of copied object (.+?) don't match","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/sync/sync.go","lineNumber":1194,"sourceCode":"\t\t\t\tif err = copyLink(src, dst, key); err != nil {\n\t\t\t\t\tlogger.Errorf(\"copy link %s failed: %s\", key, err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsrcChksum, err = copyData(src, dst, key, obj.Size(), obj.Mtime(), config.CheckAll || config.CheckNew, uploads)\n\t\t\t}\n\t\t\tif errors.Is(err, utils.ErrExtlink) {\n\t\t\t\tlogger.Warnf(\"Skip external link %s: %s\", key, err)\n\t\t\t\terr = utils.ErrSkipped\n\t\t\t}\n\n\t\t\tif err == nil && config.CheckChange {\n\t\t\t\terr = checkChange(src, dst, obj, key, config)\n\t\t\t}\n\n\t\t\tif err == nil && (config.CheckAll || config.CheckNew) {\n\t\t\t\tvar equal bool\n\t\t\t\tif equal, err = checkSum(src, dst, key, &srcChksum, obj, config); err == nil && !equal {\n\t\t\t\t\terr = fmt.Errorf(\"checksums of copied object %s don't match\", key)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif err == nil {\n\t\t\t\tif mc, ok := dst.(object.MtimeChanger); ok {\n\t\t\t\t\tif err = mc.Chtimes(obj.Key(), obj.Mtime()); err != nil && !errors.Is(err, utils.ErrNotSUP) {\n\t\t\t\t\t\tlogger.Warnf(\"Update mtime of %s: %s\", key, err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif config.Perms {\n\t\t\t\t\tcopyPerms(dst, obj, config)\n\t\t\t\t}\n\t\t\t\tcopied.Increment()\n\t\t\t} else if errors.Is(err, utils.ErrSkipped) {\n\t\t\t\tskipped.Increment()\n\t\t\t} else {\n\t\t\t\tfailed.Increment()\n\t\t\t\tlogger.Errorf(\"Failed to copy object %s: %s\", key, err)\n\t\t\t\ttaskErr = err","sourceCodeStart":1176,"sourceCodeEnd":1212,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/sync/sync.go#L1176-L1212","documentation":"Raised by checkSum during sync when --check-all or --check-new is enabled: after copying, the checksum of the destination object does not match the source's (MD5/content checksum comparison via srcChksum). It means the copy completed but the content verified as different.","triggerScenarios":"sync runs with --check-all or --check-new; after copy, checkSum reads/compares checksums (e.g. source MD5 vs destination) and they differ; the error is then returned from writeFiles for that key.","commonSituations":"Source object modified concurrently between read and checksum computation; destination backend corrupting or transforming data; syncing with a destination that doesn't preserve content byte-for-byte (e.g. compressed/gateway-transformed objects); interrupted/stale cache returning wrong content.","solutions":["Rerun sync for the object — a transient concurrent modification usually resolves; the mismatching object is typically overwritten on the next pass.","Verify the destination backend does not transform content (disable transparent compression/encryption gateways during the check).","Check for concurrent writers to the source and pause them, or exclude volatile keys from the sync.","If using caching in the source client, clear/refresh caches and re-verify.","Report persistent mismatches as a possible backend bug; check object ETags manually against both stores."],"exampleFix":"// rerun sync with checks\ndstObj, _ := dst.Head(ctx, key)\n_ = dst.Put(ctx, key, nil, body) // re-copy on mismatch\n// then re-run: juicefs sync --check-all src dst","handlingStrategy":"retry","validationCode":"// verify checksums manually after sync with --check-all\nsrcMD5, _ := md5OfFile(src, key)\ndstMD5, _ := dstHeadETag(dst, key)\nif srcMD5 != dstMD5 { log.Printf(\"mismatch on %s, will recopy\", key) }","typeGuard":null,"tryCatchPattern":"err := runSync(checkAll=true)\nif err != nil && strings.Contains(err.Error(), \"checksums of copied object\") {\n  logger.Warnf(\"checksum mismatch, recopying: %v\", err)\n  return deleteAndRecopy(extractKey(err))\n}","preventionTips":["Run sync twice; checksum mismatches from concurrent writes resolve on a later pass.","Pause writers on the source when using --check-all/--check-new.","Disable destination-side content transformations (compression gateways, etc.).","Spot-check ETags/MD5s between stores after large syncs."],"tags":["sync","checksum","data-integrity"],"backgroundTag":"checksum-mismatch","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"}