{"record":{"id":"85615631ef030192","repo":"spacedriveapp/spacedrive","slug":"failed-to-send-request-856156","errorCode":null,"errorMessage":"Failed to send request: {}","messagePattern":"Failed to send request: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"core/src/service/network/transports/sync.rs","lineNumber":269,"sourceCode":"\t\t};\n\n\t\t// Open bidirectional stream\n\t\tlet (mut send, mut recv) = conn\n\t\t\t.open_bi()\n\t\t\t.await\n\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to open bidirectional stream: {}\", e))?;\n\n\t\t// Serialize and send request\n\t\tlet req_bytes = serde_json::to_vec(&request)\n\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to serialize sync request: {}\", e))?;\n\n\t\tlet len = req_bytes.len() as u32;\n\t\tsend.write_all(&len.to_be_bytes())\n\t\t\t.await\n\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to send length: {}\", e))?;\n\t\tsend.write_all(&req_bytes)\n\t\t\t.await\n\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to send request: {}\", e))?;\n\n\t\t// Properly close send stream\n\t\tsend.finish()\n\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to finish stream: {}\", e))?;\n\n\t\tdebug!(\"Sync request sent, waiting for response...\");\n\n\t\t// Read response with timeout\n\t\tlet result = timeout(Duration::from_secs(60), async {\n\t\t\tlet mut len_buf = [0u8; 4];\n\t\t\trecv.read_exact(&mut len_buf)\n\t\t\t\t.await\n\t\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to read response length: {}\", e))?;\n\t\t\tlet resp_len = u32::from_be_bytes(len_buf) as usize;\n\n\t\t\tdebug!(\"Receiving sync response of {} bytes\", resp_len);\n\n\t\t\tlet mut resp_buf = vec![0u8; resp_len];","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/service/network/transports/sync.rs#L251-L287","documentation":"send.write_all of the serialized request body failed after the length prefix was written. The connection degraded mid-write: the peer closed the stream or connection, or the local endpoint stopped. Partial delivery is possible, so the peer may have received a truncated frame.","triggerScenarios":"Peer drops the connection while the request body is in flight; large sync requests exceeding a peer-side timeout; local endpoint shutdown mid-write.","commonSituations":"Unstable wireless links between devices; initial sync carrying a large request payload.","solutions":["Retry the request on a fresh connection; sync requests must be idempotent on the peer side for this to be safe","If the payload is large, split it into smaller messages so a single write failure costs less","Check peer reachability if the same device fails repeatedly"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if send.write_all(&req_bytes).await.is_err() {\n    active_connections.write().await.remove(&cache_key);\n    // full-send retry on a new connection; peer must tolerate duplicates\n}","preventionTips":["Split large sync payloads into smaller messages","Ensure peer handlers deduplicate retried requests","Evict the connection on any write error"],"tags":["network","sync","quic","write","partial-delivery"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}