{"record":{"id":"4e72a8aca8da63cf","repo":"AlistGo/alist","slug":"delete-failed-s","errorCode":null,"errorMessage":"delete failed: %s","messagePattern":"delete failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/guangyapan/driver.go","lineNumber":310,"sourceCode":"\nfunc (d *GuangYaPan) Remove(ctx context.Context, obj model.Obj) error {\n\tif err := d.ensureAccessToken(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tfileID := strings.TrimSpace(obj.GetID())\n\tif fileID == \"\" {\n\t\treturn errors.New(\"file id is empty\")\n\t}\n\n\tvar del deleteResp\n\tif err := d.postAPI(ctx, \"/nd.bizuserres.s/v1/file/delete_file\", map[string]any{\n\t\t\"fileIds\": []string{fileID},\n\t}, &del); err != nil {\n\t\treturn err\n\t}\n\tif !strings.EqualFold(strings.TrimSpace(del.Msg), \"success\") {\n\t\treturn fmt.Errorf(\"delete failed: %s\", strings.TrimSpace(del.Msg))\n\t}\n\n\ttaskID := strings.TrimSpace(del.Data.TaskID)\n\tif taskID == \"\" {\n\t\t// Some backends may apply deletion synchronously.\n\t\treturn nil\n\t}\n\treturn d.waitTaskDone(ctx, taskID)\n}\n\nfunc (d *GuangYaPan) Move(ctx context.Context, srcObj, dstDir model.Obj) error {\n\tif err := d.ensureAccessToken(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tfileID := strings.TrimSpace(srcObj.GetID())\n\tif fileID == \"\" {\n\t\treturn errors.New(\"file id is empty\")","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/guangyapan/driver.go#L292-L328","documentation":"GuangYaPan Delete error: /file/delete_file returned non-success msg, reported as 'delete failed: <backend msg>'. Deletion is asynchronous when the response carries a taskID; this error fires before that stage, at the initial request.","triggerScenarios":"Calling Remove where the backend rejects deletion outright: file already deleted, file locked by another task, permission level insufficient, or invalid fileIds — msg != success triggers the error before waitTaskDone runs.","commonSituations":"Deleting a file removed moments ago (double-click / duplicated requests); file engaged in an ongoing transfer; shared-to-me file without delete rights; stale cached listing.","solutions":["Read the backend msg — it distinguishes not-exists from locked from permission","Refresh the directory listing; if the file is gone, treat the delete as satisfied","Retry once pending server tasks on that file finish","Verify the account owns the file or has delete permission on the share"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := d.Remove(ctx, obj)\nif err != nil && strings.HasPrefix(err.Error(), \"delete failed\") {\n  msg := err.Error()\n  if strings.Contains(msg, \"exist\") || strings.Contains(msg, \"不存在\") {\n    // already gone: treat as success and refresh listing\n  }\n}","preventionTips":["Make delete flows idempotent: treat already-deleted as success after refreshing listing","Debounce duplicate delete requests in the UI"],"tags":["guangyapan","delete","api","backend-error"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}