{"record":{"id":"06cf803f69b146f3","repo":"AlistGo/alist","slug":"yunpan-async-task-s-failed-errno-d","errorCode":null,"errorMessage":"yunpan async task %s failed: errno=%d","messagePattern":"yunpan async task (.+?) failed: errno=(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/yunpan360/util.go","lineNumber":834,"sourceCode":"\t// Keep prior behavior when the async task is still pending after the probe window.\n\treturn nil\n}\n\nfunc checkCookieAsyncTask(task CookieAsyncTask, toleratedErrnos map[int]struct{}) (bool, error) {\n\tif task.Status != 10 {\n\t\treturn false, nil\n\t}\n\tif task.Errno == 0 {\n\t\treturn true, nil\n\t}\n\tif _, ok := toleratedErrnos[task.Errno]; ok {\n\t\treturn true, nil\n\t}\n\tif strings.TrimSpace(task.Errstr) != \"\" {\n\t\treturn true, errors.New(task.Errstr)\n\t}\n\tif strings.TrimSpace(task.Action) != \"\" {\n\t\treturn true, fmt.Errorf(\"yunpan async task %s failed: errno=%d\", task.Action, task.Errno)\n\t}\n\treturn true, fmt.Errorf(\"yunpan async task failed: errno=%d\", task.Errno)\n}\n\nfunc (d *Yunpan360) openMove(ctx context.Context, srcName, dstPath string) error {\n\tsignParams := map[string]string{\n\t\t\"src_name\": srcName,\n\t\t\"new_name\": dstPath,\n\t}\n\treturn d.openPOST(ctx, \"File.move\", signParams, nil, signParams, nil, true)\n}\n\nfunc (d *Yunpan360) openDelete(ctx context.Context, targetPath string) error {\n\treturn d.openPOST(ctx, \"File.delete\", nil, nil, map[string]string{\n\t\t\"fname\": targetPath,\n\t}, nil, true)\n}\n","sourceCodeStart":816,"sourceCodeEnd":852,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/yunpan360/util.go#L816-L852","documentation":"Produced by checkCookieAsyncTask in the yunpan360 driver while polling /async/query (waitCookieAsyncTask loops up to 15 times, 300ms apart). When a task reaches status 10 with a non-zero errno that is not in the tolerated set, and errstr is empty but the task record has a non-empty Action, the failure is reported with that action name.","triggerScenarios":"Cookie-mode operations that spawn async tasks — e.g. recycle-bin deletion (waitCookieAsyncTask with tolerated errno 3008) — where the server-side task finishes (status 10) with an error code outside the tolerated list and no errstr, but an Action field describing the failed operation.","commonSituations":"Deleting/moving large folders via the cookie API where the async job fails server-side (path already gone, permission lost, quota); a new errno appears that the driver's toleratedErrnos list (currently 3008) does not cover; cookie session partially invalidated mid-task.","solutions":["Retry the user operation; transient server-side async failures often clear","Check that the target path/owner_qid used for the async operation is still valid in the account","Confirm the cookie session is fresh (re-login) and the account has rights over the target","If the same errno recurs, extend the tolerated errno list in the waitCookieAsyncTask call only after confirming the code is benign (as was done for 3008)"],"exampleFix":"// before: only errno 3008 is tolerated during recycle deletion\nd.waitCookieAsyncTask(ctx, resp.Data.TaskID, 3008)\n\n// after: tolerate an additional confirmed-benign completion code (e.g. 'already deleted')\nd.waitCookieAsyncTask(ctx, resp.Data.TaskID, 3008, confirmedBenignErrno)","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Go: async task failures are often transient server-side; retry the creating operation once\nerr := d.waitCookieAsyncTask(ctx, taskID, 3008)\nif err != nil && strings.Contains(err.Error(), \"yunpan async task\") {\n    if retryErr := d.retryOriginalOperation(ctx); retryErr == nil { err = nil }\n}","preventionTips":["Verify target paths and owner_qid before initiating cookie-mode async operations","Keep the cookie session fresh; async jobs fail when the session degrades","Record recurring errnos and classify them before adding to tolerated sets"],"tags":["yunpan360","async","driver","polling"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}