{"record":{"id":"f27d70f7a0334790","repo":"AlistGo/alist","slug":"failed-to-marshal-rename-request-w","errorCode":null,"errorMessage":"failed to marshal rename request: %w","messagePattern":"failed to marshal rename request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"drivers/proton_drive/util.go","lineNumber":634,"sourceCode":"\t\treturn nil, fmt.Errorf(\"rename API call failed: %w\", err)\n\t}\n\n\treturn &model.Object{\n\t\tName:     newName,\n\t\tSize:     srcObj.GetSize(),\n\t\tModified: srcObj.ModTime(),\n\t\tIsFolder: srcObj.IsDir(),\n\t}, nil\n}\n\nfunc (d *ProtonDrive) executeRenameAPI(ctx context.Context, linkID string, req RenameRequest) error {\n\n\trenameURL := fmt.Sprintf(d.apiBase+\"/drive/v2/volumes/%s/links/%s/rename\",\n\t\td.MainShare.VolumeID, linkID)\n\n\treqBody, err := json.Marshal(req)\n\tif err != nil {\n\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)","sourceCodeStart":616,"sourceCodeEnd":652,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/proton_drive/util.go#L616-L652","documentation":"Returned when json.Marshal of the RenameRequest struct fails. RenameRequest is a plain struct of string fields (Name, NameSignatureEmail, Hash, OriginalHash), so marshalling is statically known to succeed; this error is effectively unreachable defensive code.","triggerScenarios":"Only if RenameRequest were changed to contain a channel, func, or cyclic reference — none exist in the current type.","commonSituations":"Virtually none; if it ever fires, suspect a fork of the driver that added an unmarshalable field (e.g. an io.Reader or map with non-string keys) to RenameRequest.","solutions":["Confirm the error is really from this line and not a wrapped child error","If a custom RenameRequest adds complex fields, implement json.Marshaler on it or pre-encode to a string"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := d.Rename(ctx, src, newName); err != nil && strings.Contains(err.Error(), \"marshal rename request\") {\n    log.Error(\"unexpected marshal failure — RenameRequest schema drifted\")\n}","preventionTips":["Keep RenameRequest fields to JSON-encodable scalars","Treat occurrence as a code-defect signal, not a runtime condition"],"tags":["proton-drive","json","unreachable"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}