{"record":{"id":"2d9630bca198bc2c","repo":"AlistGo/alist","slug":"failed-to-execute-rename-request-w","errorCode":null,"errorMessage":"failed to execute rename request: %w","messagePattern":"failed to execute rename request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/proton_drive/util.go","lineNumber":652,"sourceCode":"\t\treturn fmt.Errorf(\"failed to marshal rename request: %w\", err)\n\t}\n\n\thttpReq, err := http.NewRequestWithContext(ctx, \"PUT\", renameURL, bytes.NewReader(reqBody))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create HTTP request: %w\", err)\n\t}\n\n\thttpReq.Header.Set(\"Content-Type\", \"application/json\")\n\thttpReq.Header.Set(\"Accept\", d.protonJson)\n\thttpReq.Header.Set(\"X-Pm-Appversion\", d.webDriveAV)\n\thttpReq.Header.Set(\"X-Pm-Drive-Sdk-Version\", d.sdkVersion)\n\thttpReq.Header.Set(\"X-Pm-Uid\", d.credentials.UID)\n\thttpReq.Header.Set(\"Authorization\", \"Bearer \"+d.credentials.AccessToken)\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(httpReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to execute rename request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"rename failed with status %d\", resp.StatusCode)\n\t}\n\n\tvar renameResp RenameResponse\n\tif err := json.NewDecoder(resp.Body).Decode(&renameResp); err != nil {\n\t\treturn fmt.Errorf(\"failed to decode rename response: %w\", err)\n\t}\n\n\tif renameResp.Code != 1000 {\n\t\treturn fmt.Errorf(\"rename failed with code %d\", renameResp.Code)\n\t}\n\n\treturn nil\n}","sourceCodeStart":634,"sourceCodeEnd":670,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/proton_drive/util.go#L634-L670","documentation":"The raw http.Client (built with no Timeout: client := &http.Client{}) failed to complete the PUT rename request. This is a transport-level error: DNS failure, TCP connect failure, TLS handshake error, proxy refusal, or context cancellation — never an HTTP status.","triggerScenarios":"No network route to api.proton.me, corporate proxy/MITM rejecting the TLS cert, ctx cancelled (user aborted the operation), or connection reset mid-request.","commonSituations":"Running the mount behind a restrictive firewall; captive portal; system proxy env vars (HTTP_PROXY/HTTPS_PROXY) pointing at a dead proxy; cancellation races when the UI aborts the rename.","solutions":["Retry once after a short delay — transient resets are common","Check proxy env vars and network egress to the Proton API host","Set a Timeout on the http.Client (or rely on ctx) so failures surface quickly instead of hanging","If errors.Is(err, context.Canceled), report as user-abort, not as a fault"],"exampleFix":"// before\nclient := &http.Client{}\n// after\nclient := &http.Client{Timeout: 60 * time.Second}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"var netErr net.Error\nif errors.As(err, &netErr) || errors.Is(err, context.DeadlineExceeded) {\n    // transient transport failure: retry with backoff\n} else if errors.Is(err, context.Canceled) {\n    // user abort: do not retry\n}","preventionTips":["Set an explicit Timeout on every http.Client used for Proton API calls","Keep proxies/firewalls from blocking the Proton API host","Classify context.Canceled before retry logic"],"tags":["proton-drive","network","http","timeout"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}