FuelLabs/fuel-core · error · StorageError

The historical view is not implemented for `MemoryStore`

Error message

The historical view is not implemented for `MemoryStore`

What it means

MemoryStore::view_at_height unconditionally returns this error: historical state views are not implemented for the in-memory backend (tracked as fuel-core issue #1995). Only latest_view works on MemoryStore; any caller that needs a view at a past height will fail here.

Source

Thrown at crates/fuel-core/src/state/in_memory/memory_store.rs:238

            StorageChanges::ChangesList(changes) => {
                for changes in changes.into_iter() {
                    self._insert_changes(&mut conflicts_finder, changes)?;
                }
            }
            StorageChanges::Changes(changes) => {
                self._insert_changes(&mut conflicts_finder, changes)?;
            }
        };
        Ok(())
    }

    fn view_at_height(
        &self,
        _: &Description::Height,
    ) -> StorageResult<KeyValueView<Self::Column, Description::Height>> {
        // TODO: https://github.com/FuelLabs/fuel-core/issues/1995
        Err(
            anyhow::anyhow!("The historical view is not implemented for `MemoryStore`")
                .into(),
        )
    }

    fn latest_view(
        &self,
    ) -> StorageResult<IterableKeyValueView<Self::Column, Description::Height>> {
        let view = self.create_view();
        Ok(IterableKeyValueView::from_storage_and_metadata(
            IterableKeyValueViewWrapper::new(view),
            None,
        ))
    }

    fn rollback_block_to(&self, _: &Description::Height) -> StorageResult<()> {
        // TODO: https://github.com/FuelLabs/fuel-core/issues/1995
        Err(
            anyhow::anyhow!("The historical view is not implemented for `MemoryStore`")

View on GitHub (pinned to b9d4d170da)

Solutions

  1. Switch the database to RocksDB (database_type: DbType::RocksDb with a path) — RocksDB implements view_at_height.
  2. Restrict memory-backed usage to latest-state queries only.
  3. Track or upvote fuel-core issue #1995 for MemoryStore historical support.

Example fix

// before
config.combined_db_config.database_type = DbType::InMemory;
let view = db.on_chain().view_at_height(&height).await?; // errors

// after
config.combined_db_config.database_type = DbType::RocksDb;
config.combined_db_config.path = Some(tempdir.path().into());
let view = db.on_chain().view_at_height(&height).await?; // works
Defensive patterns

Strategy: validation

Validate before calling

use fuel_core::service::DbType;

fn can_query_historical(db_type: DbType) -> bool {
    matches!(db_type, DbType::RocksDb)
}

// before issuing historical queries
if !can_query_historical(node_config.combined_db_config.database_type) {
    return Err(anyhow::anyhow!("historical queries need a RocksDB node"));
}

Type guard

fn supports_view_at_height<Description: DatabaseDescription>(
    db: &fuel_core::state::Database<Description>,
) -> bool {
    // MemoryStore has no historical view (fuel-core #1995); only RocksDB does
    !cfg!(feature = "rocksdb") || db.is_rocksdb()
}

Try / catch

match db.view_at_height(&height) {
    Err(e) if e.to_string().contains("not implemented for `MemoryStore`") => {
        // fall back to latest_view or restart the node with database_type = RocksDb
    }
    rest => rest,
}

Prevention

When it happens

Trigger: Calling any API that ends in view_at_height while the database type is InMemory — historical GraphQL queries, balances or UTXO lookups at a past height, dry-run execution at a historical height, ViewWithMetadata::view_at_height.

Common situations: Integration tests on in-memory databases exercising historical query paths; archival or forensic tooling accidentally pointed at a memory-backed node; porting RocksDB-node code into a test harness without changing the db type.

Related errors


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