{"record":{"id":"d9c326c6df3dffb0","repo":"AlistGo/alist","slug":"up-status-d-error-s","errorCode":null,"errorMessage":"up status: %d, error: %s","messagePattern":"up status: (.+?), error: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/cloudreve/util.go","lineNumber":453,"sourceCode":"\tbodyBuilder.WriteString(\"</CompleteMultipartUpload>\")\n\treq, err := http.NewRequest(\n\t\t\"POST\",\n\t\tu.CompleteURL,\n\t\tstrings.NewReader(bodyBuilder.String()),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/xml\")\n\treq.Header.Set(\"User-Agent\", d.getUA())\n\tres, err := base.HttpClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != http.StatusOK {\n\t\tbody, _ := io.ReadAll(res.Body)\n\t\treturn fmt.Errorf(\"up status: %d, error: %s\", res.StatusCode, string(body))\n\t}\n\n\t// 上传成功发送回调请求\n\terr = d.request(http.MethodGet, \"/callback/s3/\"+u.SessionID, nil, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n","sourceCodeStart":435,"sourceCodeEnd":463,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/cloudreve/util.go#L435-L463","documentation":"Raised in Cloudreve's S3 upload finalization. After all chunks are PUT, the driver issues the complete-multipart-upload request (XML body) to S3; a non-200 response aborts with this message including the HTTP status and the raw response body, which contains S3's XML error details.","triggerScenarios":"Completing the multipart upload when S3 rejects the request: missing or mismatched parts (a chunk PUT silently failed or was retried after the part list diverged), entity-too-small last part, expired session, or invalid part-order — S3 returns 400 with an XML error that lands verbatim in this message.","commonSituations":"A mid-upload retry desynchronized the ETag/part list sent in the complete request; uploading a final chunk smaller than S3's minimum part size (5 MiB) for non-terminal parts; S3-compatible backends with stricter complete semantics.","solutions":["Read the XML body in the error message — it names the exact S3 error (InvalidPart, EntityTooSmall, NoSuchUpload)","Restart the upload from scratch so the part list and ETags stay consistent","Ensure all parts except the last are at least 5 MiB (raise chunk size if needed)","Verify the server's S3 configuration and session validity"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-flight: verify all part ETags were collected and parts meet size rules before completing\nif len(etags) != expectedPartCount {\n    return fmt.Errorf(\"part count %d != expected %d; aborting complete\", len(etags), expectedPartCount)\n}","typeGuard":null,"tryCatchPattern":"if err := d.completeS3Upload(...); err != nil {\n    if strings.Contains(err.Error(), \"up status:\") {\n        // parse the XML body for InvalidPart/EntityTooSmall/NoSuchUpload and decide:\n        // NoSuchUpload/InvalidPart -> restart the whole upload; EntityTooSmall -> bigger chunks\n    }\n}","preventionTips":["Record every part's ETag in order and validate the list before sending complete","Ensure non-terminal parts are at least 5 MiB","Never reuse a multipart session after a mid-upload error; restart cleanly"],"tags":["alist","cloudreve","s3","multipart","finalize","upload"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}