{"record":{"id":"16e728e50085199a","repo":"AlistGo/alist","slug":"wukong-move-failed-code-d-message-s","errorCode":null,"errorMessage":"wukong move failed: code=%d message=%s","messagePattern":"wukong move failed: code=(.+?) message=(.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/wukong/driver.go","lineNumber":242,"sourceCode":"\tvar resp rawResp\n\t_, err := d.client.R().\n\t\tSetContext(ctx).\n\t\tSetQueryParams(map[string]string{\n\t\t\t\"aid\":             d.Aid,\n\t\t\t\"device_platform\": \"web\",\n\t\t\t\"language\":        d.Language,\n\t\t}).\n\t\tSetBody(map[string]any{\n\t\t\t\"file_id_list\":  []any{asIDValue(srcID)},\n\t\t\t\"new_father_id\": asIDValue(dstID),\n\t\t}).\n\t\tSetResult(&resp).\n\t\tPost(\"/netdisk/user_file/move_file\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.Code != 0 {\n\t\treturn fmt.Errorf(\"wukong move failed: code=%d message=%s\", resp.Code, resp.Message)\n\t}\n\treturn nil\n}\n\nfunc (d *Wukong) Rename(ctx context.Context, srcObj model.Obj, newName string) error {\n\tsrcID := srcObj.GetID()\n\tif srcID == \"\" {\n\t\treturn errors.New(\"missing file id\")\n\t}\n\n\tvar resp rawResp\n\t_, err := d.client.R().\n\t\tSetContext(ctx).\n\t\tSetQueryParams(map[string]string{\n\t\t\t\"aid\":             d.Aid,\n\t\t\t\"device_platform\": \"web\",\n\t\t\t\"language\":        d.Language,\n\t\t}).","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/wukong/driver.go#L224-L260","documentation":"Thrown by the Wukong driver's Move after POSTing file_id_list plus new_father_id to /netdisk/user_file/move_file. The transport call succeeded but resp.Code is non-zero: the API rejected the move operation. Typical causes are invalid/missing file IDs, target directory problems, or insufficient permission on the destination.","triggerScenarios":"Moving an object whose GetID() is empty or stale (file deleted remotely); moving into a destination dir ID that no longer exists; moving into its own subtree; moving a file the account does not own; session expired.","commonSituations":"Stale listing cache in the frontend showing files already deleted from the Wukong web pan; drag-and-drop move where dstDir was concurrently renamed; copy tasks racing each other with the same source; account permission changed on a shared folder.","solutions":["Re-List both the source parent and destination directory to obtain fresh IDs, then retry the move","Check that srcID and dstID are non-empty and that dstDir is a folder (not a file) before calling Move","Refresh Wukong credentials if the business code indicates auth failure","Guard against moving a directory into itself or one of its descendants before issuing the API call"],"exampleFix":"// before\nfunc (d *Wukong) Move(ctx context.Context, srcObj, dstDir model.Obj) error {\n    // direct API call\n}\n\n// after\nfunc (d *Wukong) Move(ctx context.Context, srcObj, dstDir model.Obj) error {\n    if srcObj.GetID() == \"\" || dstDir.GetID() == \"\" {\n        return errors.New(\"missing source or destination id\")\n    }\n    if srcObj.GetID() == dstDir.GetID() || isDescendant(ctx, d, srcObj, dstDir) {\n        return errors.New(\"cannot move a folder into itself\")\n    }\n    // direct API call\n}","handlingStrategy":"validation","validationCode":"if srcObj.GetID() == \"\" || dstDir.GetID() == \"\" {\n    return errors.New(\"move aborted: missing source or destination id\")\n}\nif srcObj.GetID() == dstDir.GetID() {\n    return errors.New(\"move aborted: source and destination are the same\")\n}","typeGuard":null,"tryCatchPattern":"if err := d.Move(ctx, srcObj, dstDir); err != nil {\n    if isWukongAuthErr(err) { // session code: refresh and retry once\n        if rerr := d.refreshSession(ctx); rerr == nil {\n            return d.Move(ctx, srcObj, dstDir)\n        }\n    }\n    return err\n}","preventionTips":["Always validate non-empty IDs before calling Move","Block moves of a folder into its own subtree","Re-List source and destination when a move fails to detect already-moved/already-deleted objects"],"tags":["wukong","move","api-error","cloud-storage","go"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}