{"record":{"id":"27a6deb0175967e5","repo":"spacedriveapp/spacedrive","slug":"failed-to-send-request","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/protocol/sync/transport.rs","lineNumber":172,"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).await.map_err(|e| {\n\t\t\t\tanyhow::anyhow!(\"Failed to read response length: {}\", e)\n\t\t\t})?;\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":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/service/network/protocol/sync/transport.rs#L154-L190","documentation":"Writing the serialized request body failed after the length prefix went out. Same failure class as the length-prefix write - connection lost or stream reset mid-write - with a larger window because the body is much bigger than 4 bytes.","triggerScenarios":"Connection drop during body transfer; peer resetting the stream after reading only the prefix; very large payloads failing as the link degrades.","commonSituations":"Large sync diffs over slow links; peer standby mid-transfer.","solutions":["Retry the request on a fresh connection","Cap sync request payload size and paginate large operations","Log bytes.len() with the error to spot oversized payloads"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"Err(e) if e.to_string().contains(\"Failed to send request\") => {\n    // body write failed: connection dropped mid-transfer, retry once\n    retry_request_on_fresh_connection(device, request).await\n}","preventionTips":["Cap request payload size; chunk large sync operations into multiple requests","Log payload size with write errors to distinguish link loss from oversized messages","Retry once before declaring the peer unreachable"],"tags":["network","iroh","quic","streams","sync","rust"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}