{"record":{"id":"b66ebbe7950e5b9e","repo":"AlistGo/alist","slug":"up-status-d-error-s-b66ebb","errorCode":null,"errorMessage":"up status: %d, error: %s","messagePattern":"up status: (.+?), error: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/cloudreve_v4/util.go","lineNumber":469,"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\treturn d.request(http.MethodPost, \"/callback/s3/\"+u.SessionID+\"/\"+u.CallbackSecret, func(req *resty.Request) {\n\t\treq.SetBody(\"{}\")\n\t}, nil)\n}\n","sourceCodeStart":451,"sourceCodeEnd":477,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/cloudreve_v4/util.go#L451-L477","documentation":"Raised in Cloudreve v4's S3 upload finalization. After all parts are uploaded, the driver sends the complete-multipart-upload request; a non-200 response aborts with this message embedding the HTTP status and the raw body (S3 XML error). On success it then fires the /callback/s3/{session}/{secret} POST, whose failure returns a different error.","triggerScenarios":"S3 rejecting the complete-multipart-upload call: InvalidPart (part/ETag list desynced after mid-upload retries), EntityTooSmall, NoSuchUpload (expired session), or request signature issues — the XML detail is included verbatim in the error.","commonSituations":"Retry-induced ETag mismatch between uploaded parts and the complete request; last part below S3 minimum size; session expiry on very long uploads; stricter S3-compatible backends.","solutions":["Read the embedded XML error name to pinpoint the cause (InvalidPart / EntityTooSmall / NoSuchUpload)","Restart the upload so parts and ETags remain consistent end-to-end","Ensure every non-final part is at least 5 MiB (increase chunk size)","Validate the server's S3 credentials and session before large uploads"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-flight: validate the ETag list matches the planned part count before completing\nif len(etags) != expectedPartCount {\n    return fmt.Errorf(\"incomplete part list (%d/%d); aborting complete\", len(etags), expectedPartCount)\n}","typeGuard":null,"tryCatchPattern":"if err := d.completeUpload(...); err != nil {\n    if strings.Contains(err.Error(), \"up status:\") {\n        // parse the embedded XML: NoSuchUpload/InvalidPart -> restart upload;\n        // EntityTooSmall -> raise chunk size; otherwise surface to user\n    }\n}","preventionTips":["Build the complete request's part list from responses, never from plan assumptions","Restart uploads cleanly after any mid-upload error","Size chunks so all non-final parts are at least 5 MiB"],"tags":["alist","cloudreve-v4","s3","multipart","finalize","upload"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}