{"record":{"id":"2968b3bb3d1d7b04","repo":"AlistGo/alist","slug":"rename-merge-file-s-w","errorCode":null,"errorMessage":"rename merge file %s: %w","messagePattern":"rename merge file (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/sjtu_netdisk/driver.go","lineNumber":420,"sourceCode":"\t\t\t}\n\n\t\t\ttargetDirObj := &model.Object{Path: dstPath, Name: newName, IsFolder: true}\n\n\t\t\tfor _, child := range children {\n\t\t\t\tchildSrcPath := path.Join(srcObj.GetPath(), child.GetName())\n\n\t\t\t\tif child.IsDir() {\n\t\t\t\t\tchildObj := &model.Object{\n\t\t\t\t\t\tName: child.GetName(), Path: childSrcPath,\n\t\t\t\t\t\tSize: child.GetSize(), IsFolder: true,\n\t\t\t\t\t}\n\t\t\t\t\tif _, mergeErr := d.Move(ctx, childObj, targetDirObj); mergeErr != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"rename merge subfolder %s: %w\", child.GetName(), mergeErr)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfileErr := d.moveItem(ctx, childSrcPath, dstPath, child.GetName(), false, \"overwrite\")\n\t\t\t\t\tif fileErr != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"rename merge file %s: %w\", child.GetName(), fileErr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_ = d.Remove(ctx, srcObj)\n\n\t\t\treturn &model.Object{\n\t\t\t\tName:     newName,\n\t\t\t\tSize:     srcObj.GetSize(),\n\t\t\t\tIsFolder: true,\n\t\t\t\tModified: srcObj.ModTime(),\n\t\t\t\tCtime:    srcObj.CreateTime(),\n\t\t\t\tPath:     dstPath,\n\t\t\t}, nil\n\t\t}\n\n\t\treturn nil, fmt.Errorf(\"unexpected rename folder response: status=%d\", resp.StatusCode())\n\t}","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/sjtu_netdisk/driver.go#L402-L438","documentation":"During a rename-merge in the SJTU driver, moving one child FILE into the renamed folder failed (moveItem with \"overwrite\" strategy). The message names the file; the wrapped error carries the API failure. Files are force-overwritten, so this is a transport/API error, not a conflict.","triggerScenarios":"Rename folder onto an existing name triggers the merge loop; the per-file move PUT fails for one file (expired token, 5xx, server lock).","commonSituations":"Bulk merges with one bad file aborting everything; file held open elsewhere; transient API errors under load.","solutions":["Retry the rename after addressing the wrapped error","Move/rename the named file manually to confirm it succeeds alone","Close clients holding the file open, then retry","Split large renames into smaller batches"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"rename merge file\") {\n    f := extractFileName(err)\n    return moveSingleFile(ctx, f)\n}","preventionTips":["Retry the named file individually","Ensure no other client holds the file","Keep rename-merges small to reduce failure surface"],"tags":["sjtu-netdisk","rename","merge","file"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}