{"record":{"id":"5049e97d4bef5c8f","repo":"linera-io/linera-protocol","slug":"chain-is-expecting-a-next-block-at-height-expecte-5049e9","errorCode":null,"errorMessage":"Chain is expecting a next block at height {expected_block_height} but the given block is at height {found_block_height} instead","messagePattern":"Chain is expecting a next block at height (.+?) but the given block is at height (.+?) instead","errorType":"validation","errorClass":"WorkerError","httpStatus":null,"severity":"error","filePath":"linera-core/src/chain_worker/state.rs","lineNumber":2702,"sourceCode":"        &mut self,\n        query: ChainInfoQuery,\n    ) -> Result<ChainInfoResponse, WorkerError> {\n        self.initialize_and_save_if_needed().await?;\n        let mut info = ChainInfo::from_chain_view(&mut self.chain).await?;\n        let chain = &self.chain;\n        if query.request_owner_balance == AccountOwner::CHAIN {\n            info.requested_owner_balance = Some(*chain.execution_state.system.balance.get());\n        } else {\n            info.requested_owner_balance = chain\n                .execution_state\n                .system\n                .balances\n                .get(&query.request_owner_balance)\n                .await?;\n        }\n        if let Some(next_block_height) = query.test_next_block_height {\n            // If not, send the same error as if a block with next_block_height was proposed.\n            ensure!(\n                chain.tip_state.get().next_block_height == next_block_height,\n                WorkerError::UnexpectedBlockHeight {\n                    expected_block_height: chain.tip_state.get().next_block_height,\n                    found_block_height: next_block_height,\n                }\n            );\n        }\n        if query.request_pending_message_bundles {\n            let mut bundles = Vec::new();\n            let nonempty_origins: Vec<ChainId> =\n                chain.nonempty_inboxes.get().iter().copied().collect();\n            #[cfg(with_metrics)]\n            metrics::NUM_INBOXES\n                .with_label_values(&[])\n                .observe(nonempty_origins.len() as f64);\n            let is_closed = *chain.execution_state.system.closed.get();\n            let action = if is_closed {\n                MessageAction::Reject","sourceCodeStart":2684,"sourceCodeEnd":2720,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-core/src/chain_worker/state.rs#L2684-L2720","documentation":"Error \"Chain is expecting a next block at height {expected_block_height} but the given block is at height {found_block_height} instead\" thrown in linera-io/linera-protocol.","triggerScenarios":"A block proposal or certificate is processed whose height does not match the chain's expected next block height, e.g. after a skipped or repeated block.","commonSituations":"Retrying an already-committed block, submitting an outdated proposal after the chain advanced, or racing two clients proposing blocks for the same chain.","solutions":["Sync the chain to the expected block height before proposing the next block: run `linera sync` (or `linera sync-balance`) so the local view reaches {expected_block_height}, then retry the operation.","If a pending block exists at the conflicting height, run `linera retry-pending-block` to commit or clear it before proposing a new block.","Ensure no concurrent client processes are proposing blocks for the same chain; serialize block proposals through a single client instance."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}