FuelLabs/fuel-core · error

The genesis block height is not found in the database during

Error message

The genesis block height is not found in the database during overriding the chain config hash.

What it means

Thrown by override_chain_config_if_needed (crates/fuel-core/src/service.rs:365). When the chain config root hash differs from the chain_config_hash stored in the genesis consensus, the node rewrites the SealedBlockConsensus genesis entry at the stored genesis height. on_chain_view.genesis_height() returned None: the database yields a genesis object but no recorded genesis block height, so the update target is missing and startup fails.

Source

Thrown at crates/fuel-core/src/service.rs:365

        Ok(())
    }

    fn override_chain_config_if_needed(&self) -> anyhow::Result<()> {
        let chain_config = self.shared.config.snapshot_reader.chain_config();
        let on_chain_view = self.shared.database.on_chain().latest_view()?;
        let chain_config_hash = chain_config.root()?.into();
        let mut initialized_genesis = on_chain_view.get_genesis()?;
        let genesis_chain_config_hash = initialized_genesis.chain_config_hash;

        if genesis_chain_config_hash != chain_config_hash {
            tracing::warn!(
                "The genesis chain config hash({genesis_chain_config_hash}) \
                is different from the current one({chain_config_hash}). \
                Updating the genesis consensus parameters."
            );

            let genesis_block_height =
                on_chain_view.genesis_height()?.ok_or(anyhow::anyhow!(
                    "The genesis block height is not found in the database \
                    during overriding the chain config hash."
                ))?;
            let mut database_tx = on_chain_view.read_transaction();

            initialized_genesis.chain_config_hash = chain_config_hash;
            database_tx
                .storage_as_mut::<SealedBlockConsensus>()
                .insert(
                    &genesis_block_height,
                    &Consensus::Genesis(initialized_genesis),
                )?;

            self.shared.database.on_chain().data.commit_changes(
                Some(genesis_block_height),
                StorageChanges::Changes(database_tx.into_changes()),
            )?;
        }

View on GitHub (pinned to b9d4d170da)

Solutions

  1. Wipe the on-chain database directory and let the node re-execute genesis with the new chain config
  2. Restore the database from a consistent snapshot taken after genesis was fully committed
  3. If the config change was accidental, revert to the chain config whose hash matches the DB (the mismatching hashes are printed in the preceding warn log)

Example fix

# before: fuel run --chain-config new-config.json  (old DB present, fails)
# after:  stop node, remove the DB dir (default ~/.fuel/db and cohort dirs), then:
#         fuel run --chain-config new-config.json  (genesis re-executed)
Defensive patterns

Strategy: validation

Validate before calling

let view = db.on_chain().latest_view()?;
if view.get_genesis().is_ok() {
    let has_height = view.genesis_height()?.is_some();
    anyhow::ensure!(has_height,
        "inconsistent DB: genesis present but genesis_height missing; re-init before changing chain config");
}

Try / catch

if let Err(e) = node.check_and_override_chain_config() {
    if e.to_string().contains("genesis block height is not found") {
        // half-initialized DB: only real fix is wipe + re-execute genesis
    }
}

Prevention

When it happens

Trigger: Starting with a changed chain config (edited chain_config.json or different --chain-config) against an on-chain database whose genesis state is half-written: get_genesis() succeeds but genesis_height() is None.

Common situations: Process crash/kill during first-time genesis initialization; a pruned, partially copied, or restored-from-inconsistent-snapshot database; mixing DB directories between chains or node versions.

Related errors


AI-assisted analysis of FuelLabs/fuel-core@b9d4d170da (2026-08-16). Data as JSON: /api/errors/4e7414a2dce2a30f. Report an issue: GitHub.