{"record":{"id":"058edd64b1250cb4","repo":"FuelLabs/fuel-core","slug":"no-p2p-service-available","errorCode":null,"errorMessage":"No P2P service available","messagePattern":"No P2P service available","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/fuel-core/src/service/adapters/sync.rs","lineNumber":56,"sourceCode":"            Some(service) => fuel_core_services::stream::IntoBoxStream::into_boxed(\n                tokio_stream::wrappers::BroadcastStream::new(\n                    service.subscribe_block_height(),\n                )\n                .filter_map(|r| futures::future::ready(r.ok().map(|r| r.block_height))),\n            ),\n            _ => fuel_core_services::stream::IntoBoxStream::into_boxed(\n                tokio_stream::pending(),\n            ),\n        }\n    }\n\n    async fn get_sealed_block_headers(\n        &self,\n        block_height_range: Range<u32>,\n    ) -> anyhow::Result<SourcePeer<Option<Vec<SealedBlockHeader>>>> {\n        let result = match &self.service {\n            Some(service) => service.get_sealed_block_headers(block_height_range).await,\n            _ => Err(anyhow::anyhow!(\"No P2P service available\")),\n        };\n        match result {\n            Ok((peer_id, headers)) => {\n                let peer_id: PeerId = peer_id.into();\n                let headers = peer_id.bind(headers);\n                Ok(headers)\n            }\n            Err(err) => Err(err),\n        }\n    }\n\n    async fn get_transactions(\n        &self,\n        block_ids: Range<u32>,\n    ) -> anyhow::Result<SourcePeer<Option<Vec<Transactions>>>> {\n        let result = match &self.service {\n            Some(service) => service.get_transactions(block_ids).await,\n            _ => Err(anyhow::anyhow!(\"No P2P service available\")),","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/fuel-core/src/service/adapters/sync.rs#L38-L74","documentation":"P2PAdapter holds Option<Service>; when the node runs without P2P (feature off or networking not configured) the adapter is built with service: None and every PeerToPeerPort method that needs the network errors. This one is get_sealed_block_headers: header fetches from peers are impossible. Note height_stream degrades to a pending stream, so the failure only appears once sync actually fetches.","triggerScenarios":"The sync service calls get_sealed_block_headers(block_height_range) on a node whose P2PAdapter has no service — p2p disabled in config or the binary built without the p2p feature.","commonSituations":"Local/dev nodes started without network config but attempting state sync; binaries without the p2p feature pointed at a chain that requires peer sync; config where p2p is None while sync is active.","solutions":["Enable P2P: build with `--features p2p` and provide network configuration (bootstrap nodes, etc.).","If networking is intentionally off, use snapshot/import-based sync instead of peer sync.","Fix configs that both disable p2p and enable peer-driven sync."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Before relying on peer sync, confirm P2P is configured:\nfn p2p_available(config: &Config) -> bool {\n    #[cfg(feature = \"p2p\")]\n    { config.p2p.is_some() }\n    #[cfg(not(feature = \"p2p\"))]\n    { false }\n}\nif !p2p_available(&config) {\n    anyhow::bail!(\"peer header fetch unavailable: P2P not configured\");\n}","typeGuard":"fn is_peer_sync_capable(config: &Config) -> bool {\n    cfg!(feature = \"p2p\") && config.p2p.is_some()\n}","tryCatchPattern":"match header_fetch {\n    Err(e) if e.to_string().contains(\"No P2P service available\") => {\n        // expected on non-networked nodes: fall back to snapshot/import sync\n        tracing::warn!(\"P2P unavailable; skipping peer header fetch\");\n        return Ok(None);\n    }\n    other => other,\n}","preventionTips":["Decide the sync mode upfront: peer sync requires p2p config + feature; otherwise use snapshot/import.","Fail config validation when sync-from-peers is requested but p2p is None.","Remember height_stream silently pends without P2P — absence of heights is the early symptom."],"tags":["p2p","network","configuration","sync"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}