AlistGo/alist · info
failed to marshal move request: %w
Error message
failed to marshal move request: %w
What it means
Returned when json.Marshal of MoveRequest fails. MoveRequest consists of strings, a nil-able ContentHash, and passphrase strings — all JSON-safe — so this branch is effectively unreachable with the current type definition.
Source
Thrown at drivers/proton_drive/util.go:698
//fmt.Printf("DEBUG Move Request - ContentHash: %v\n", req.ContentHash)
//fmt.Printf("DEBUG Move Request - NodePassphrase length: %d\n", len(req.NodePassphrase))
//fmt.Printf("DEBUG Move Request - NodePassphraseSignature length: %d\n", len(req.NodePassphraseSignature))
//fmt.Printf("DEBUG Move Request - SrcLinkID: %s\n", linkID)
//fmt.Printf("DEBUG Move Request - DstParentLinkID: %s\n", req.ParentLinkID)
//fmt.Printf("DEBUG Move Request - ShareID: %s\n", d.MainShare.ShareID)
srcLink, _ := d.getLink(ctx, linkID)
if srcLink != nil && srcLink.ParentLinkID == req.ParentLinkID {
return fmt.Errorf("cannot move to same parent directory")
}
moveURL := fmt.Sprintf(d.apiBase+"/drive/v2/volumes/%s/links/%s/move",
d.MainShare.VolumeID, linkID)
reqBody, err := json.Marshal(req)
if err != nil {
return fmt.Errorf("failed to marshal move request: %w", err)
}
httpReq, err := http.NewRequestWithContext(ctx, "PUT", moveURL, bytes.NewReader(reqBody))
if err != nil {
return fmt.Errorf("failed to create HTTP request: %w", err)
}
httpReq.Header.Set("Authorization", "Bearer "+d.credentials.AccessToken)
httpReq.Header.Set("Accept", d.protonJson)
httpReq.Header.Set("X-Pm-Appversion", d.webDriveAV)
httpReq.Header.Set("X-Pm-Drive-Sdk-Version", d.sdkVersion)
httpReq.Header.Set("X-Pm-Uid", d.credentials.UID)
httpReq.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(httpReq)
if err != nil {
return fmt.Errorf("failed to execute move request: %w", err)View on GitHub (pinned to 843d9dc814)
Solutions
- Verify the error's %w chain actually points at this Marshal call
- Keep MoveRequest limited to JSON-encodable scalar fields, or add custom MarshalJSON
Defensive patterns
Strategy: try-catch
Try / catch
if err != nil && strings.Contains(err.Error(), "marshal move request") {
log.Error("MoveRequest schema defect — not a runtime condition")
} Prevention
- Keep MoveRequest to JSON-encodable fields
- Treat occurrence as code smell, never retry
When it happens
Trigger: Only if MoveRequest gains a channel/func/cyclic field in a fork; nothing in the shipped type can trigger it.
Common situations: Essentially none; treat any occurrence as a sign the error is actually a wrapped child from elsewhere or a modified struct.
Related errors
- failed to marshal rename request: %w
- failed to decode rename response: %w
- failed to decode move response: %w
- Too many parts, please increase part size
- invalid json
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/330d0454c1417709.
Report an issue: GitHub.