{"record":{"id":"fe48a59a531b2d6b","repo":"spacedriveapp/spacedrive","slug":"file-transfer-protocol-not-registered","errorCode":null,"errorMessage":"File transfer protocol not registered","messagePattern":"File transfer protocol not registered","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"core/src/ops/files/copy/strategy.rs","lineNumber":366,"sourceCode":"\t\t\tname: local_path\n\t\t\t\t.file_name()\n\t\t\t\t.unwrap_or_default()\n\t\t\t\t.to_string_lossy()\n\t\t\t\t.to_string(),\n\t\t\tsize: file_size,\n\t\t\tmodified: metadata.modified().ok(),\n\t\t\tis_directory: metadata.is_dir(),\n\t\t\tchecksum,\n\t\t\tmime_type: None,\n\t\t};\n\n\t\tlet networking_guard = &*networking;\n\t\tlet protocol_registry = networking_guard.protocol_registry();\n\t\tlet registry_guard = protocol_registry.read().await;\n\n\t\tlet file_transfer_handler = registry_guard\n\t\t\t.get_handler(\"file_transfer\")\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\"File transfer protocol not registered\"))?;\n\n\t\tlet file_transfer_protocol = file_transfer_handler\n\t\t\t.as_any()\n\t\t\t.downcast_ref::<crate::service::network::protocol::FileTransferProtocolHandler>()\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Invalid file transfer protocol handler\"))?;\n\n\t\tlet transfer_id = file_transfer_protocol\n\t\t\t.initiate_transfer(\n\t\t\t\tdest_device_id,\n\t\t\t\tlocal_path.to_path_buf(),\n\t\t\t\tcrate::service::network::protocol::TransferMode::TrustedCopy,\n\t\t\t)\n\t\t\t.await?;\n\n\t\tdebug!(\"PUSH transfer initiated with ID: {}\", transfer_id);\n\t\tctx.log(format!(\"PUSH transfer initiated with ID: {}\", transfer_id));\n\n\t\tlet result = stream_file_data(","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/ops/files/copy/strategy.rs#L348-L384","documentation":"PUSH fetches the protocol handler registered under the name \"file_transfer\" from the NetworkingService's ProtocolRegistry (the canonical handler's protocol_name() returns \"file_transfer\", core/src/service/network/protocol/file_transfer.rs:1429). None means the registry never received a FileTransferProtocolHandler — networking came up without registering built-in protocols, registration failed, or a custom registry construction omitted it.","triggerScenarios":"NetworkingService started in a mode that skips built-in protocol registration; init-order bug where the copy job runs before registration completes; test or embedded setup constructing a bare ProtocolRegistry without the file-transfer handler.","commonSituations":"Custom daemon builds with protocol registration toggled off; startup error during registration swallowed earlier; refactoring that moved registration out of the boot path.","solutions":["Check daemon startup logs for protocol registration failures and fix/re-run registration","Ensure NetworkingService initialization registers built-in protocols before any copy job is dispatched","If you construct the ProtocolRegistry yourself, register FileTransferProtocolHandler explicitly","Restart the daemon after fixing init so the registry is repopulated"],"exampleFix":"// before\nlet mut registry = ProtocolRegistry::new(); // no built-ins registered\n\n// after\nlet mut registry = ProtocolRegistry::new();\nregistry.register(std::sync::Arc::new(\n    crate::service::network::protocol::FileTransferProtocolHandler::new(),\n));","handlingStrategy":"validation","validationCode":"let networking = ctx.networking_service().ok_or_else(|| anyhow::anyhow!(\"no networking\"))?;\nlet registry = networking.protocol_registry();\nif registry.read().await.get_handler(\"file_transfer\").is_none() {\n    return Err(anyhow::anyhow!(\"file_transfer protocol not registered; networking started without built-ins\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register built-in protocols during NetworkingService init and assert registration in startup checks","Log registered protocol names at daemon boot to catch missing handlers early","In custom/test registries, always add FileTransferProtocolHandler before running copy jobs"],"tags":["rust","spacedrive","push","protocol-registry","networking","initialization"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}