AlistGo/alist · error
unexpected rename folder response: status=%d
Error message
unexpected rename folder response: status=%d
What it means
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.
Source
Thrown at drivers/sjtu_netdisk/driver.go:437
if fileErr != nil {
return nil, fmt.Errorf("rename merge file %s: %w", child.GetName(), fileErr)
}
}
}
_ = d.Remove(ctx, srcObj)
return &model.Object{
Name: newName,
Size: srcObj.GetSize(),
IsFolder: true,
Modified: srcObj.ModTime(),
Ctime: srcObj.CreateTime(),
Path: dstPath,
}, nil
}
return nil, fmt.Errorf("unexpected rename folder response: status=%d", resp.StatusCode())
}
}
func (d *SJTUNetdisk) Copy(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error) {
if err := d.refreshToken(ctx); err != nil {
return nil, err
}
srcPath := srcObj.GetPath()
targetPath := path.Join(dstDir.GetPath(), srcObj.GetName())
// file copy
if !srcObj.IsDir() {
copyURL := fmt.Sprintf("%s/file/%s/%s/%s", API_URL, d.libraryId, d.spaceId, d.encodePath(targetPath))
var copyResp MoveCopyResp
_, err := d.newClient().R().
SetContext(ctx).View on GitHub (pinned to 843d9dc814)
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
Defensive patterns
Strategy: try-catch
Try / catch
if err != nil {
var st int
if n, _ := fmt.Sscanf(err.Error(), "unexpected rename folder response: status=%d", &st); n == 1 {
switch {
case st == 401: reauthAndRetry()
case st == 404: refreshListing()
default: return err
}
}
} Prevention
- Branch on the printed status code for targeted remediation
- Keep credentials fresh to avoid 401 fall-through
- Verify folder existence before renaming
When it happens
Trigger: Rename folder PUT returns 401 (expired token), 403 (no permission), 404 (source missing), or 5xx — none of which are handled branches.
Common situations: 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.
Related errors
- rename API call failed: %w
- unexpected status code: %d
- no Location header in redirect response
- rename merge: list source folder failed: %w
- rename merge subfolder %s: %w
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/cbb969c5acc737a6.
Report an issue: GitHub.