{"record":{"id":"0ab790aae52fffef","repo":"AlistGo/alist","slug":"upload-part-failed-crc32-mismatch-expected-s-g","errorCode":null,"errorMessage":"upload part failed: crc32 mismatch, expected %s, got %s","messagePattern":"upload part failed: crc32 mismatch, expected (.+?), got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/doubao/util.go","lineNumber":713,"sourceCode":"\n\t\treq.SetQueryParams(map[string]string{\n\t\t\t\"uploadid\":    uploadID,\n\t\t\t\"part_number\": strconv.FormatInt(partNumber, 10),\n\t\t\t\"phase\":       \"transfer\",\n\t\t})\n\n\t\treq.SetBody(data)\n\t\treq.SetContentLength(true)\n\t}, &uploadResp)\n\n\tif err != nil {\n\t\treturn resp, err\n\t}\n\n\tif uploadResp.Code != 2000 {\n\t\treturn resp, fmt.Errorf(\"upload part failed: %s\", uploadResp.Message)\n\t} else if uploadResp.Data.Crc32 != crc32Value {\n\t\treturn resp, fmt.Errorf(\"upload part failed: crc32 mismatch, expected %s, got %s\", crc32Value, uploadResp.Data.Crc32)\n\t}\n\n\treturn uploadResp.Data, nil\n}\n\n// 完成分片上传\nfunc (d *Doubao) completeMultipartUpload(config *UploadConfig, uploadUrl, uploadID string, parts []UploadPart) error {\n\tuploadResp := UploadResp{}\n\n\tstoreInfo := config.InnerUploadAddress.UploadNodes[0].StoreInfos[0]\n\n\tbody := _convertUploadParts(parts)\n\n\terr := utils.Retry(MaxRetryAttempts, time.Second, func() (err error) {\n\t\t_, err = d.uploadRequest(uploadUrl, http.MethodPost, storeInfo, func(req *resty.Request) {\n\t\t\treq.SetQueryParams(map[string]string{\n\t\t\t\t\"uploadid\":   uploadID,\n\t\t\t\t\"phase\":      \"finish\",","sourceCodeStart":695,"sourceCodeEnd":731,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/doubao/util.go#L695-L731","documentation":"Integrity check failure in uploadPart: the client computed CRC32 of the part data before sending, but the server's response envelope reports a different Crc32. The stored bytes do not match what was read, indicating corruption or tampering in transit, or a server-side recalculation mismatch.","triggerScenarios":"A part POST where the body got altered/corrupted en route (proxy mangling, connection truncation with a 'successful' status), server computed CRC over different bytes (offset mismatch in the chunking logic), or extremely rarely a hash collision-free bug where part data was mutated between calculateCRC32 and send (shared buffer reuse across goroutines).","commonSituations":"Corporate proxies or MITM devices rewriting bodies, flaky NIC/NAT corrupting large POSTs, race conditions when the part buffer is reused by concurrent goroutines before send completes, or chunk-offset arithmetic bugs after driver changes.","solutions":["Retry the part — transient corruption will pass on a clean connection (retry keeps the same CRC so genuine corruption keeps failing)","Disable/inspect any HTTP proxy between OpenList and the upload host","If reproducible on one specific part index, suspect offset arithmetic or buffer reuse in the driver; verify the bytes read at that offset","Check memory/hardware stability if corruption is widespread and random","Compare expected vs got CRC values: a mismatch on the LAST part may point to wrong final-chunk sizing"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := d.uploadPart(...); err != nil {\n    if strings.Contains(err.Error(), \"crc32 mismatch\") {\n        // re-read the part from disk (fresh bytes) and retry once before failing\n        data = rereadPart(offset, size)\n        return d.uploadPart(...)\n    }\n    return err\n}","preventionTips":["Ensure part buffers aren't mutated between CRC computation and send (no shared slice reuse across goroutines)","Bypass proxies that rewrite POST bodies","Investigate repeated same-part CRC mismatches as local disk corruption"],"tags":["doubao","upload","crc32","integrity","corruption","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}