spacedriveapp/spacedrive · error · anyhow::Error
Unexpected response to pull request
Error message
Unexpected response to pull request
What it means
The first message the peer sent back was not a PullResponse at all (strategy.rs:570-574). The connection and stream succeeded, but the dialogue is desynchronized — the remote speaks a different protocol version that frames the exchange differently, or it pushed an unexpected message (e.g. TransferError) where the response was expected.
Source
Thrown at core/src/ops/files/copy/strategy.rs:571
file_metadata: Some(metadata),
..
} => {
ctx.log(format!(
"PullRequest accepted: {} bytes",
metadata.size
));
metadata
}
crate::service::network::protocol::file_transfer::FileTransferMessage::PullResponse {
accepted: false,
error,
..
} => {
let err_msg = error.unwrap_or_else(|| "Unknown error".to_string());
return Err(anyhow::anyhow!("Pull request rejected: {}", err_msg));
}
_ => {
return Err(anyhow::anyhow!(
"Unexpected response to pull request"
));
}
};
let file_size = file_metadata.size;
// Ensure parent directory exists
if let Some(parent) = local_dest_path.parent() {
fs::create_dir_all(parent).await?;
}
// Determine final file path
let final_dest_path =
if local_dest_path.is_dir() || local_dest_path.to_string_lossy().ends_with('/') {
// Destination is a directory - append source filename
let dir_path = local_dest_path.to_path_buf();
fs::create_dir_all(&dir_path).await?;View on GitHub (pinned to 6dfeccf211)
Solutions
- Ensure both devices run the same core/daemon version, then retry
- Log the raw first message (msg_type byte and length) to identify what arrived instead
- Re-pair the devices after an upgrade so protocol state is consistent
- If it persists on identical versions, capture logs from both sides and report a protocol bug
Defensive patterns
Strategy: try-catch
Try / catch
match remote_strategy.execute_pull(ctx, &src, &dst).await {
Ok(n) => Ok(n),
Err(e) if e.to_string().contains("Unexpected response to pull request") => {
// almost always a version mismatch: block retries until versions align
mark_peer_incompatible(peer_id);
Err(anyhow::anyhow!("protocol desync with peer; align daemon versions and retry: {}", e))
}
Err(e) => Err(e),
} Prevention
- Upgrade both devices together so FileTransferMessage ordering stays compatible
- Log the unexpected message type when this fires to identify the divergence
- Version-handshake peers before starting file transfers
When it happens
Trigger: Mixed daemon versions where the remote's file-transfer protocol emits a different first message; a proxy or middle layer altering the byte stream; peer bug sending an error or handshake message instead of the PullResponse.
Common situations: Only one device of a pair upgraded; experimental builds with changed FileTransferMessage ordering; protocol refactor deployed inconsistently.
Related errors
- Pull request rejected: {}
- Chunk {} checksum mismatch
- Byte count mismatch: expected {}, got {}
- Final checksum mismatch
- Invalid file transfer protocol handler
AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16).
Data as JSON: /api/errors/45655a23c9140f2e.
Report an issue: GitHub.