{"record":{"id":"ffcd607186731fdc","repo":"spacedriveapp/spacedrive","slug":"failed-to-deserialize-sync-response","errorCode":null,"errorMessage":"Failed to deserialize sync response: {}","messagePattern":"Failed to deserialize sync response: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"core/src/service/network/protocol/sync/transport.rs","lineNumber":211,"sourceCode":"\t\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to read response: {}\", e))?;\n\t\t\tOk::<_, anyhow::Error>(resp_buf)\n\t\t})\n\t\t.await;\n\n\t\tlet resp_buf = match result {\n\t\t\tOk(Ok(buf)) => buf,\n\t\t\tOk(Err(e)) => return Err(e),\n\t\t\tErr(_) => {\n\t\t\t\treturn Err(anyhow::anyhow!(\n\t\t\t\t\t\"Sync request timed out after 60s - peer {} not responding\",\n\t\t\t\t\ttarget_device\n\t\t\t\t))\n\t\t\t}\n\t\t};\n\n\t\t// Deserialize response\n\t\tlet response: SyncMessage = serde_json::from_slice(&resp_buf)\n\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to deserialize sync response: {}\", e))?;\n\n\t\tdebug!(\n\t\t\tdevice_uuid = %target_device,\n\t\t\tresponse_type = ?std::mem::discriminant(&response),\n\t\t\t\"Received sync response\"\n\t\t);\n\n\t\tOk(response)\n\t}\n\n\t/// Get list of currently connected sync partner devices\n\t///\n\t/// Returns device UUIDs that are both:\n\t/// - Registered in DeviceRegistry (paired)\n\t/// - Currently have an active connection\n\t///\n\t/// Note: This doesn't query the sync_partners table - that's the caller's responsibility.\n\t/// We just report which devices are network-reachable right now.","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/service/network/protocol/sync/transport.rs#L193-L229","documentation":"The response bytes were read but did not deserialize as a SyncMessage. In this protocol it almost always means version skew - the peer serialized an enum variant or field layout your build does not know - or the payload was truncated or garbled in transit.","triggerScenarios":"Two devices running different spacedrive versions with changed SyncMessage enums; renamed or removed serde tags; truncation from a mid-body failure; peer speaking a different framing on the same ALPN.","commonSituations":"Upgrading one machine but not the other; refactors that rename enum variants or restructure payloads without compatibility handling.","solutions":["Upgrade both devices to the same version","Log the serde error plus the first bytes of the payload to identify the offending variant","Keep serde enum tags stable across releases and tolerate unknown variants where possible","Add a protocol version to the handshake or ALPN so mismatches fail fast"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_deserialize_failure(err: &anyhow::Error) -> bool {\n    err.to_string().contains(\"Failed to deserialize sync response\")\n}","tryCatchPattern":"match net.send_sync_request(device, request).await {\n    Ok(resp) => { /* ... */ }\n    Err(e) if is_deserialize_failure(&e) => {\n        // almost always version skew: do not retry; surface 'incompatible version' to the user\n        Err(anyhow::anyhow!(\"device {} runs an incompatible version\", device))\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Upgrade paired devices together","Keep serde enum tags stable; use untagged or tolerant variants for forward compat","Negotiate a protocol version in the handshake so mismatches fail fast"],"tags":["serde","json","version-skew","protocol","sync","rust"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}