{"record":{"id":"08655d75cc9dacd5","repo":"AlistGo/alist","slug":"rename-failed-s-08655d","errorCode":null,"errorMessage":"rename failed: %s","messagePattern":"rename failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/guangyapan/driver.go","lineNumber":288,"sourceCode":"\n\tfileID := strings.TrimSpace(srcObj.GetID())\n\tif fileID == \"\" {\n\t\treturn errors.New(\"file id is empty\")\n\t}\n\tname := strings.TrimSpace(newName)\n\tif name == \"\" {\n\t\treturn errors.New(\"new name is empty\")\n\t}\n\n\tvar out commonResp\n\tif err := d.postAPI(ctx, \"/nd.bizuserres.s/v1/file/rename\", map[string]any{\n\t\t\"fileId\":  fileID,\n\t\t\"newName\": name,\n\t}, &out); err != nil {\n\t\treturn err\n\t}\n\tif !strings.EqualFold(strings.TrimSpace(out.Msg), \"success\") {\n\t\treturn fmt.Errorf(\"rename failed: %s\", strings.TrimSpace(out.Msg))\n\t}\n\treturn nil\n}\n\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 {","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/guangyapan/driver.go#L270-L306","documentation":"GuangYaPan Rename error: /file/rename returned HTTP success but msg != 'success', surfaced as 'rename failed: <backend msg>'. The backend message explains the rejection, e.g. name conflicts or forbidden characters.","triggerScenarios":"Calling Rename with a newName that already exists in the same folder, an empty-after-trim name (guarded earlier), or a fileID the backend considers invalid/locked, causing the rename endpoint to report a non-success msg.","commonSituations":"Renaming to an existing name in the same directory; backend character validation on names; renaming a file involved in a pending server-side task; stale file ID after upstream re-organization.","solutions":["Inspect the backend msg appended to the error for the precise cause","Ensure the target name is unique within the folder and uses allowed characters","Retry after any in-flight server-side task (move/copy) on the same file completes","Refresh the object listing so fileID matches the current upstream state"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"func safeNewName(parentListing []model.Obj, newName string) bool {\n  for _, o := range parentListing { if o.GetName() == newName { return false } }\n  return strings.TrimSpace(newName) != \"\"\n}","typeGuard":null,"tryCatchPattern":"err := d.Rename(ctx, srcObj, newName)\nif err != nil && strings.HasPrefix(err.Error(), \"rename failed\") {\n  // surface backend msg to user; retry only after confirming no name conflict\n}","preventionTips":["Pre-check destination names for uniqueness before issuing renames","Avoid renaming while other server-side tasks on the file are in flight"],"tags":["guangyapan","rename","api","backend-error"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}