{"record":{"id":"96ed7f478f8fb178","repo":"spacedriveapp/spacedrive","slug":"failed-to-deserialize-sync-response-96ed7f","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/transports/sync.rs","lineNumber":308,"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 FOR THIS LIBRARY\n\t///\n\t/// Returns device UUIDs that are:\n\t/// 1. Members of this specific library (in devices table)\n\t/// 2. Have sync_enabled=true in this library\n\t/// 3. Currently network-connected (according to Iroh)\n\tasync fn get_connected_sync_partners(\n\t\t&self,","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/service/network/transports/sync.rs#L290-L326","documentation":"serde_json::from_slice::<SyncMessage> failed on the received response bytes: the payload is not valid JSON for the SyncMessage type. The dominant cause is version skew, where the peer encodes variants or fields this build does not know. Corrupted buffers are rare because read_exact enforces the announced length.","triggerScenarios":"Peers running different core versions exchange sync messages with enum drift; the peer replied with a plain-text error string instead of a JSON frame; a peer truncation bug produced invalid bytes that still matched the announced length.","commonSituations":"Updating one device of a pair but not the other; development builds talking to release builds; a peer database imported from a newer schema.","solutions":["Update both devices to the same core version and re-test the sync exchange","Log the first bytes of resp_buf before failing, to see what the peer actually sent","Add a protocol version to the sync ALPN or a message header so mismatched peers fail fast with a clear version error instead of a serde error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Verify both peers report the same protocol/core version before syncing\nassert_eq!(local_version, peer_version, \"sync protocol mismatch\");","typeGuard":null,"tryCatchPattern":"match serde_json::from_slice::<SyncMessage>(&resp_buf) {\n    Err(e) => {\n        warn!(error = %e, head = ?&resp_buf[..resp_buf.len().min(64)], \"unparseable sync response, likely version skew\");\n        return Err(e.into());\n    }\n    Ok(msg) => msg,\n}","preventionTips":["Update paired devices together so both run the same core version","Version the sync protocol in the ALPN or a header and reject mismatches up front","Log the first bytes of an unparseable response to identify what the peer sent"],"tags":["serde","deserialization","sync","version-skew"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}