{"record":{"id":"f6891d0655e4f0fd","repo":"linera-io/linera-protocol","slug":"l2-partial-sync-local-sync-failed-category","errorCode":null,"errorMessage":"L2 partial sync: local sync failed ({category})","messagePattern":"L2 partial sync: local sync failed \\((.+?)\\)","errorType":"exception","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"linera-service/src/cli/validator_benchmark/partial_sync.rs","lineNumber":66,"sourceCode":"        duration_secs: 0.0,\n        blocks_per_sec: 0.0,\n    };\n\n    let chain_client = context.make_chain_client(chain).await?;\n\n    // The local sync can be heavy (it downloads the certificates to push); give\n    // it a visible spinner so it never looks frozen. NOTE: on a tall chain the\n    // wallet does not track, this can exceed --rpc-timeout-secs; raise it or use\n    // a tracked chain if the seed times out here.\n    let sync_phase = progress.phase(\"L2 partial sync: local state\", None);\n    let local_tip = match timed(rpc_timeout, chain_client.synchronize_chain_state(chain)).await {\n        Ok(info) => {\n            sync_phase.finish_ok();\n            info.next_block_height.0\n        }\n        Err(category) => {\n            sync_phase.finish_fail();\n            anyhow::bail!(\"L2 partial sync: local sync failed ({category})\");\n        }\n    };\n\n    // The candidate may not yet know the chain at all (BlobsNotFound -> 0).\n    let candidate_tip = match timed(\n        rpc_timeout,\n        node.handle_chain_info_query(linera_core::data_types::ChainInfoQuery::new(chain)),\n    )\n    .await\n    {\n        Ok(response) => response.info.next_block_height.0,\n        Err(_) => 0,\n    };\n\n    let from = candidate_tip;\n    let to = end_height(candidate_tip, max_blocks, local_tip);\n    report.from_height = from;\n    report.to_height = to;","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/cli/validator_benchmark/partial_sync.rs#L48-L84","documentation":"The opt-in `--deep` partial-sync layer first synchronizes the local chain client (`chain_client.synchronize_chain_state(chain)`) under the RPC timeout. If that sync fails, the categorized error (timeout, node error, etc.) is embedded in the bail and the benchmark aborts. Per the module docs, on a tall chain the wallet does not track, this local sync can exceed `--rpc-timeout-secs` because it downloads all certificates up to the local tip.","triggerScenarios":"Running `validator-benchmark --deep` where the local `synchronize_chain_state` call exceeds `--rpc-timeout-secs` or errors out — typically a tall chain that the wallet does not track, or a slow/unreachable local node.","commonSituations":"Deep-benchmarking a long-running chain with the default RPC timeout; benchmarking client with slow disk/network; the seed chain not present in the wallet.","solutions":["Raise the timeout: pass a larger --rpc-timeout-secs (the sync downloads certificates up to the local tip)","Benchmark a chain the wallet tracks (add/follow the chain first) so local sync is cheap","Read the category in the message — non-timeout categories (e.g. node errors) indicate something to fix on the node side first","Run without --deep if the write-path (push) measurement is not needed"],"exampleFix":"# before\nlinera validator benchmark <addr> --chain <id> --deep --rpc-timeout-secs 30\n\n# after\nlinera validator benchmark <addr> --chain <id> --deep --rpc-timeout-secs 300","handlingStrategy":"retry","validationCode":"// Cheap guard: make sure the wallet tracks the chain before a deep run.\nlet wallet = options.wallet()?;\nanyhow::ensure!(\n    wallet.chain_ids().contains(&chain_id),\n    \"chain {chain_id} not tracked by the wallet; local sync will re-download the whole chain\"\n);","typeGuard":null,"tryCatchPattern":"match partial_sync::run(&node, &ctx, chain, max_blocks, rpc_timeout, &progress).await {\n    Err(e) if e.to_string().contains(\"L2 partial sync: local sync failed\") => {\n        // most common cause is rpc_timeout too small for a tall untracked chain:\n        // raise --rpc-timeout-secs and retry, or track the chain first\n        retry_with(rpc_timeout * 4).await?;\n    }\n    result => result?,\n}","preventionTips":["Scale --rpc-timeout-secs with chain height when using --deep on long chains","Add the target chain to the wallet (follow it) before deep benchmarking so local sync is incremental","Read the category in parentheses — timeouts need a bigger budget, node errors need a node fix"],"tags":["validator-benchmark","partial-sync","timeout","linera-cli"],"backgroundTag":"sync-timeout","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}