{"record":{"id":"c61690e15e5d6bee","repo":"AlistGo/alist","slug":"up-msg","errorCode":null,"errorMessage":"up.Msg","messagePattern":"up\\.Msg","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/cloudreve/util.go","lineNumber":287,"sourceCode":"\t\t\tres, err := base.HttpClient.Do(req)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer res.Body.Close()\n\t\t\tif res.StatusCode != 200 {\n\t\t\t\treturn errors.New(res.Status)\n\t\t\t}\n\t\t\tbody, err := io.ReadAll(res.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tvar up Resp\n\t\t\terr = json.Unmarshal(body, &up)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif up.Code != 0 {\n\t\t\t\treturn errors.New(up.Msg)\n\t\t\t}\n\t\t\treturn nil\n\t\t}()\n\t\tif err == nil {\n\t\t\tretryCount = 0\n\t\t\tfinish += byteSize\n\t\t\tup(float64(finish) * 100 / float64(stream.GetSize()))\n\t\t\tchunk++\n\t\t} else {\n\t\t\tretryCount++\n\t\t\tif retryCount > maxRetries {\n\t\t\t\treturn fmt.Errorf(\"upload failed after %d retries due to server errors, error: %s\", maxRetries, err)\n\t\t\t}\n\t\t\tbackoff := time.Duration(1<<retryCount) * time.Second\n\t\t\tutils.Log.Warnf(\"[Cloudreve-Remote] server errors while uploading, retrying after %v...\", backoff)\n\t\t\ttime.Sleep(backoff)\n\t\t}\n\t}","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/cloudreve/util.go#L269-L305","documentation":"Cloudreve local upload chunk returned HTTP 200 but the JSON envelope in the body has a non-zero code; the server's message (up.Msg) is returned. This is the API-level failure of an otherwise HTTP-successful chunk PUT.","triggerScenarios":"upLocal closure: json.Unmarshal(body, &up) succeeds, up.Code != 0. Typical when the upload session is invalid/finished, the credential does not cover this chunk index, or the server rejects the chunk size/hash.","commonSituations":"Uploading a file larger than policy limits so later chunks get rejected; resuming an upload whose session was completed or garbage-collected; concurrent uploads of the same file confusing session state.","solutions":["Restart the upload from scratch (new session) instead of resuming — session state on the server is likely stale.","Raise the storage policy size limit in Cloudrebve if the failure starts at a consistent file size.","Verify the driver's chunk size settings do not conflict with the server-side policy.","Check Cloudrebve server logs for the exact code/message pair."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// inside the upLocal loop the driver already retries; catch at the caller and restart cleanly\nif err := d.upLocal(ctx, stream, dirPath, overwrite, up); err != nil {\n    if strings.Contains(err.Error(), \"session\") || strings.Contains(err.Error(), \"credential\") {\n        return d.upLocal(ctx, stream, dirPath, overwrite, up) // fresh session, once\n    }\n    return err\n}","preventionTips":["Do not resume stale upload sessions; start new ones","Match driver chunk size with server policy","Check server logs when up.Msg repeats on the same chunk index"],"tags":["cloudreve","upload","api-error","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}