{"record":{"id":"d362f03f35e5b3dd","repo":"AlistGo/alist","slug":"copy-merge-subfolder-s-w","errorCode":null,"errorMessage":"copy merge subfolder %s: %w","messagePattern":"copy merge subfolder (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/sjtu_netdisk/driver.go","lineNumber":516,"sourceCode":"\n\t\t\ttargetDirObj := &model.Object{\n\t\t\t\tPath:     targetPath,\n\t\t\t\tName:     srcObj.GetName(),\n\t\t\t\tIsFolder: true,\n\t\t\t}\n\n\t\t\tfor _, child := range children {\n\t\t\t\tchildSrcPath := path.Join(srcPath, 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(),\n\t\t\t\t\t\tPath:     childSrcPath,\n\t\t\t\t\t\tSize:     child.GetSize(),\n\t\t\t\t\t\tIsFolder: true,\n\t\t\t\t\t}\n\t\t\t\t\tif _, mergeErr := d.Copy(ctx, childObj, targetDirObj); mergeErr != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"copy merge subfolder %s: %w\", child.GetName(), mergeErr)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tchildEncoded := d.encodePath(path.Join(targetPath, child.GetName()))\n\t\t\t\t\tchildURL := fmt.Sprintf(\"%s/file/%s/%s/%s\", API_URL, d.libraryId, d.spaceId, childEncoded)\n\t\t\t\t\tif _, fileErr := d.newClient().R().\n\t\t\t\t\t\tSetContext(ctx).\n\t\t\t\t\t\tSetQueryParam(\"access_token\", d.accessToken).\n\t\t\t\t\t\tSetQueryParam(\"conflict_resolution_strategy\", \"overwrite\").\n\t\t\t\t\t\tSetBody(map[string]interface{}{\"copyFrom\": childSrcPath}).\n\t\t\t\t\t\tExecute(http.MethodPut, childURL); fileErr != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"copy 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\treturn &model.Object{\n\t\t\t\tName:     srcObj.GetName(),\n\t\t\t\tSize:     srcObj.GetSize(),","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/sjtu_netdisk/driver.go#L498-L534","documentation":"During a copy-merge in the SJTU driver, recursively copying one child subfolder into the target failed. The message names the subfolder; the wrapped error is the recursive Copy failure (auth, 5xx, or deeper merge error).","triggerScenarios":"Copy folder onto an existing name triggers the merge loop; d.Copy(childObj, targetDirObj) errors for one subfolder.","commonSituations":"Deep trees where one failing branch aborts the entire copy; token expiry during long copies; destination quota exceeded partway.","solutions":["Retry the copy of the named subfolder in isolation","Check the wrapped error (auth, quota, permission) and remediate","Verify quota on the destination space before copying large trees","Split large copies into per-subfolder operations"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"copy merge subfolder\") {\n    sub := extractSubfolderName(err)\n    return copySingleSubfolder(ctx, sub) // resumes the merge\n}","preventionTips":["Check destination quota before large copies","Retry from the named subfolder; earlier children are already copied","Keep auth fresh during long-running copies"],"tags":["sjtu-netdisk","copy","merge","recursion"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}