{"record":{"id":"e30b07051f3114f1","repo":"AlistGo/alist","slug":"rename-merge-list-source-folder-failed-w","errorCode":null,"errorMessage":"rename merge: list source folder failed: %w","messagePattern":"rename merge: list source folder failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/sjtu_netdisk/driver.go","lineNumber":401,"sourceCode":"\t\t}\n\n\t\t// 204 means no conflict\n\t\tif resp.StatusCode() == http.StatusNoContent {\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\t// 409 means conflict name\n\t\tif resp.StatusCode() == http.StatusConflict {\n\t\t\tchildren, listErr := d.List(ctx, srcObj, model.ListArgs{})\n\t\t\tif listErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"rename merge: list source folder failed: %w\", listErr)\n\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 {","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/sjtu_netdisk/driver.go#L383-L419","documentation":"During a Rename of a folder that hits a 409 name conflict, the SJTU driver merges by moving all children into the renamed folder. This error means the List call to enumerate the source folder's children failed, so the rename-merge aborted before moving anything. The wrapped error is the actual List failure.","triggerScenarios":"Renaming a folder to a name that already exists at the same level; the follow-up d.List(ctx, srcObj) fails from an expired token, the folder disappearing mid-rename, or a transient API error.","commonSituations":"Another client deleted or moved the source folder concurrently; token expiry between the rename attempt and the listing; very large folders timing out on list.","solutions":["Inspect the wrapped List error for the root cause","Refresh the directory in the AList UI and retry the rename once the source is confirmed present","Avoid renaming folders that are being modified concurrently by other clients","If the target name must be kept, manually merge contents first, then rename an empty folder"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"rename merge: list source folder failed\") {\n    refreshDir(parentOf(src))\n    return retryRenameOnce()\n}","preventionTips":["Do not rename folders being modified concurrently","Confirm the source folder lists correctly before renaming onto an existing name","Pre-merge contents manually if the target name must be kept"],"tags":["sjtu-netdisk","rename","merge","recursion"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}