linera-io/linera-protocol · error · ExecutionError

EventsNotFound

EventsNotFound

Error message

ExecutionError::EventsNotFound(missing_events)

What it means

At the end of an UpdateStream, the system verifies the publisher's newest event (EventId at index next_index - 1 on the publisher chain and stream) is readable by this node via the extra context's contains_event oracle (system.rs:660-668). If any checked event is missing locally, the operation fails with EventsNotFound listing the missing EventIds, so a subscriber never records progress past events it cannot actually read.

Source

Thrown at linera-execution/src/system.rs:666

                    .checked_sub(1)
                    .ok_or(ArithmeticError::Underflow)?;
                let event_id = EventId {
                    chain_id,
                    stream_id,
                    index,
                };
                let context = self.context();
                let extra = context.extra();
                let mut missing_events = Vec::new();
                txn_tracker
                    .oracle(|| async {
                        if !extra.contains_event(event_id.clone()).await? {
                            missing_events.push(event_id.clone());
                        }
                        Ok(OracleResponse::EventExists(event_id))
                    })
                    .await?;
                ensure!(
                    missing_events.is_empty(),
                    ExecutionError::EventsNotFound(missing_events)
                );
            }
            Checkpoint => {
                return Err(ExecutionError::InternalError(
                    "SystemOperation::Checkpoint must be dispatched at ExecutionStateView level",
                ));
            }
        }

        Ok(new_application)
    }

    /// Returns an error if the `provided` epoch is not exactly one higher than the chain's current
    /// epoch.
    fn check_next_epoch(&self, provided: Epoch) -> Result<(), ExecutionError> {
        let expected = self.epoch.get().try_add_one()?;

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Retry after the node syncs: wait for or trigger the fetch of the missing events from peers, then resubmit the UpdateStream operations.
  2. Ensure event/blob distribution is healthy so the publisher's events reach the subscriber's node (check peer connectivity, blob gossip).
  3. For late joiners or pruned history, obtain the publisher's events (or its checkpoint snapshot) from storage/peers before resuming stream processing.
  4. If older events are permanently gone, resubscribe from the current index (unsubscribe then subscribe) and accept the gap rather than replaying pruned events.

Example fix

// before
client.submit_operations(update_stream_ops).await?; // EventsNotFound [...]

// after: ensure the referenced event exists locally first, else retry later
loop {
    let missing = node.query_event(publisher_event_id).await;
    if missing.is_ok() { break; }
    tokio::time::sleep(Duration::from_secs(5)).await; // wait for blob/event sync
}
client.submit_operations(update_stream_ops).await?;
Defensive patterns

Strategy: retry

Validate before calling

// verify the newest referenced event exists locally before submitting
let event_id = EventId { chain_id: publisher, stream_id, index: next_index - 1 };
if node.get_event(event_id.clone()).await.is_err() {
    // trigger/await event sync first; skip this round
}

Try / catch

match result {
    Err(ExecutionError::EventsNotFound(missing)) => {
        // transient sync gap: fetch/wait for the listed events, then retry the
        // same UpdateStream once storage has them; give up only if the events
        // are confirmed pruned and resubscribe from the current index instead
    }
    other => other,
}

Prevention

When it happens

Trigger: Executing UpdateStream when the subscriber's local node does not have the publisher's latest event blob: events not yet synced/gossiped from the publisher chain, blob fetches still pending, or the events having been pruned or checkpointed away before this node retrieved them.

Common situations: Nodes processing streams right after the publisher emitted, before cross-chain data propagated; indexer/explorer or late-joining nodes lacking historical publisher data; publisher chains pruning old events (or publishing checkpoints) while slow subscribers lag behind; local test setups where nodes were restarted without storage of previously seen events.

Related errors


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