{"record":{"id":"cbb969c5acc737a6","repo":"AlistGo/alist","slug":"unexpected-rename-folder-response-status-d","errorCode":null,"errorMessage":"unexpected rename folder response: status=%d","messagePattern":"unexpected rename folder response: status=(.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/sjtu_netdisk/driver.go","lineNumber":437,"sourceCode":"\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}\n}\n\nfunc (d *SJTUNetdisk) Copy(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error) {\n\tif err := d.refreshToken(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tsrcPath := srcObj.GetPath()\n\ttargetPath := path.Join(dstDir.GetPath(), srcObj.GetName())\n\n\t// file copy\n\tif !srcObj.IsDir() {\n\t\tcopyURL := fmt.Sprintf(\"%s/file/%s/%s/%s\", API_URL, d.libraryId, d.spaceId, d.encodePath(targetPath))\n\n\t\tvar copyResp MoveCopyResp\n\t\t_, err := d.newClient().R().\n\t\t\tSetContext(ctx).","sourceCodeStart":419,"sourceCodeEnd":455,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/sjtu_netdisk/driver.go#L419-L455","documentation":"The SJTU driver's folder Rename got a response status it does not recognize: not the success it checks earlier, not 409 (handled as merge), and whatever status was returned falls through to this error. The status code is printed, so the failure is identifiable from the message alone.","triggerScenarios":"Rename folder PUT returns 401 (expired token), 403 (no permission), 404 (source missing), or 5xx — none of which are handled branches.","commonSituations":"Token expired before the rename call; renaming a folder that was deleted elsewhere; write permission lost on the space; upstream API change adding a new required parameter.","solutions":["Match the printed status: 401 → re-save credentials; 403 → check space permissions; 404 → refresh, the folder is gone; 5xx → retry later","Confirm the rename works in the official SJTU client","Re-authenticate the driver and retry","Report persistent unknown statuses as a driver issue with the status code"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil {\n    var st int\n    if n, _ := fmt.Sscanf(err.Error(), \"unexpected rename folder response: status=%d\", &st); n == 1 {\n        switch {\n        case st == 401: reauthAndRetry()\n        case st == 404: refreshListing()\n        default: return err\n        }\n    }\n}","preventionTips":["Branch on the printed status code for targeted remediation","Keep credentials fresh to avoid 401 fall-through","Verify folder existence before renaming"],"tags":["sjtu-netdisk","rename","http"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}