{"record":{"id":"bf6d9c735f6f88dd","repo":"AlistGo/alist","slug":"get-task-status-failed-s","errorCode":null,"errorMessage":"get task status failed: %s","messagePattern":"get task status failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/guangyapan/driver.go","lineNumber":862,"sourceCode":"\t\treturn fmt.Errorf(\"request failed: status=%d body=%s\", resp.StatusCode(), resp.String())\n\t}\n\treturn nil\n}\n\nfunc (d *GuangYaPan) waitTaskDone(ctx context.Context, taskID string) error {\n\tconst (\n\t\tmaxTry   = 30\n\t\tinterval = 300 * time.Millisecond\n\t)\n\tfor i := 0; i < maxTry; i++ {\n\t\tvar out taskStatusResp\n\t\tif err := d.postAPI(ctx, \"/nd.bizuserres.s/v1/get_task_status\", 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 !strings.EqualFold(strings.TrimSpace(out.Msg), \"success\") {\n\t\t\treturn fmt.Errorf(\"get task status failed: %s\", strings.TrimSpace(out.Msg))\n\t\t}\n\t\tswitch out.Data.Status {\n\t\tcase 2:\n\t\t\treturn nil\n\t\tcase -1, 3:\n\t\t\treturn fmt.Errorf(\"task %s failed with status=%d\", taskID, out.Data.Status)\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(\"task %s timeout\", taskID)\n}","sourceCodeStart":844,"sourceCodeEnd":880,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/guangyapan/driver.go#L844-L880","documentation":"waitTaskDone polls /nd.bizuserres.s/v1/get_task_status up to 30 times at 300ms intervals and throws this when the response envelope's Msg is not 'success' (case-insensitive). It means the provider acknowledged the HTTP request but the API-level status for the task query itself failed - e.g. unknown taskId or server-side rejection - distinct from the task failing.","triggerScenarios":"A copy/move/delete task ID is polled but get_task_status returns a non-success Msg: task record not found (expired or never committed), transient provider error, or the task belongs to another session.","commonSituations":"Polling a task created long ago whose record was purged; provider API hiccup mid-poll; session mismatch after a token refresh rotated accounts.","solutions":["Retry the whole operation once - transient non-success Msgs usually clear.","If it persists with the same taskId, assume the task is gone and re-initiate the operation.","Check provider status pages for incidents if many tasks fail at once."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := d.waitTaskDone(ctx, taskID); err != nil {\n    if strings.Contains(err.Error(), \"get task status failed\") {\n        // envelope-level failure, usually transient\n        time.Sleep(time.Second)\n        return d.waitTaskDone(ctx, taskID)\n    }\n    return err\n}","preventionTips":["Poll freshly created tasks promptly; old taskIds may be purged.","Treat envelope failures differently from task failures (status -1/3)."],"tags":["task-polling","api-status","guangyapan"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}