linera-io/linera-protocol · error · WorkerError

Chain is expecting a next block at height {expected_block_he

Error message

Chain is expecting a next block at height {expected_block_height} but the given block is at height {found_block_height} instead

What it means

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.

Source

Thrown at linera-core/src/chain_worker/state.rs:2702

        &mut self,
        query: ChainInfoQuery,
    ) -> Result<ChainInfoResponse, WorkerError> {
        self.initialize_and_save_if_needed().await?;
        let mut info = ChainInfo::from_chain_view(&mut self.chain).await?;
        let chain = &self.chain;
        if query.request_owner_balance == AccountOwner::CHAIN {
            info.requested_owner_balance = Some(*chain.execution_state.system.balance.get());
        } else {
            info.requested_owner_balance = chain
                .execution_state
                .system
                .balances
                .get(&query.request_owner_balance)
                .await?;
        }
        if let Some(next_block_height) = query.test_next_block_height {
            // If not, send the same error as if a block with next_block_height was proposed.
            ensure!(
                chain.tip_state.get().next_block_height == next_block_height,
                WorkerError::UnexpectedBlockHeight {
                    expected_block_height: chain.tip_state.get().next_block_height,
                    found_block_height: next_block_height,
                }
            );
        }
        if query.request_pending_message_bundles {
            let mut bundles = Vec::new();
            let nonempty_origins: Vec<ChainId> =
                chain.nonempty_inboxes.get().iter().copied().collect();
            #[cfg(with_metrics)]
            metrics::NUM_INBOXES
                .with_label_values(&[])
                .observe(nonempty_origins.len() as f64);
            let is_closed = *chain.execution_state.system.closed.get();
            let action = if is_closed {
                MessageAction::Reject

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. 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.
  2. If a pending block exists at the conflicting height, run `linera retry-pending-block` to commit or clear it before proposing a new block.
  3. Ensure no concurrent client processes are proposing blocks for the same chain; serialize block proposals through a single client instance.

When it happens

Trigger: 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.

Common situations: Retrying an already-committed block, submitting an outdated proposal after the chain advanced, or racing two clients proposing blocks for the same chain.


AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22). Data as JSON: /api/errors/5049e97d4bef5c8f. Report an issue: GitHub.