{"record":{"id":"072981ca345ddd21","repo":"AlistGo/alist","slug":"upload-task-failed-code-d-msg-s","errorCode":null,"errorMessage":"upload task failed: code=%d msg=%s","messagePattern":"upload task failed: code=(.+?) msg=(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/guangyapan/driver.go","lineNumber":952,"sourceCode":"\t\tmaxTry   = 300\n\t\tinterval = 1 * time.Second\n\t)\n\tfor i := 0; i < maxTry; i++ {\n\t\tvar out taskInfoResp\n\t\tif err := d.postAPI(ctx, \"/nd.bizuserres.s/v1/file/get_info_by_task_id\", map[string]any{\n\t\t\t\"taskId\": taskID,\n\t\t}, &out); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif out.Data.FileID != \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tswitch out.Code {\n\t\tcase 145, 146, 147, 155, 163, 0:\n\t\t\t// uploading/verifying/processing\n\t\tdefault:\n\t\t\tif strings.TrimSpace(out.Msg) != \"\" {\n\t\t\t\treturn fmt.Errorf(\"upload task failed: code=%d msg=%s\", out.Code, strings.TrimSpace(out.Msg))\n\t\t\t}\n\t\t}\n\t\tif i == maxTry-1 {\n\t\t\tbreak\n\t\t}\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-time.After(interval):\n\t\t}\n\t}\n\treturn fmt.Errorf(\"upload task %s timeout\", taskID)\n}\n\nfunc (d *GuangYaPan) multipartUploadToOSS(ctx context.Context, bucket *oss.Bucket, objectPath string, file model.FileStreamer, up driver.UpdateProgress) error {\n\tpartSize := calcUploadPartSize(file.GetSize())\n\timur, err := bucket.InitiateMultipartUpload(objectPath, oss.Sequential())\n\tif err != nil {","sourceCodeStart":934,"sourceCodeEnd":970,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/guangyapan/driver.go#L934-L970","documentation":"waitUploadTaskInfo polls the upload task and throws when the response Code is not in the accepted in-progress set (145/146/147/155/163/0) and a non-empty Msg accompanies it. That means the provider reported a definitive failure for the upload task rather than a progress state.","triggerScenarios":"After bytes are pushed to OSS, the server-side ingest/verify fails and the next get_task_status poll returns an error code + message (e.g. data integrity failure, task cancelled server-side).","commonSituations":"Multipart upload completed but parts were missing/corrupt; provider-side transcoding/verification failed; task invalidated by a concurrent delete of the target path.","solutions":["Retry the upload from scratch - transient ingest failures usually succeed on retry.","If it repeats for the same file, suspect corruption at the source or a provider incident.","Check the embedded code+msg against provider documentation for the specific failure class."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := d.waitUploadTaskInfo(ctx, taskID); err != nil {\n    if strings.Contains(err.Error(), \"upload task failed: code=\") {\n        // definitive ingest failure: retry the whole upload once\n        return d.Put(ctx, dstDir, file, overwrite)\n    }\n    return err\n}","preventionTips":["Retry failed uploads from scratch rather than resuming stale tasks.","Watch for repeated codes on the same file - indicates source corruption or provider policy."],"tags":["upload","task-failed","verification","guangyapan"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}