{"record":{"id":"9baf40c6e3f6172b","repo":"FuelLabs/fuel-core","slug":"the-historical-view-is-not-implemented-for-memory","errorCode":null,"errorMessage":"The historical view is not implemented for `MemoryStore`","messagePattern":"The historical view is not implemented for `MemoryStore`","errorType":"exception","errorClass":"StorageError","httpStatus":null,"severity":"error","filePath":"crates/fuel-core/src/state/in_memory/memory_store.rs","lineNumber":238,"sourceCode":"            StorageChanges::ChangesList(changes) => {\n                for changes in changes.into_iter() {\n                    self._insert_changes(&mut conflicts_finder, changes)?;\n                }\n            }\n            StorageChanges::Changes(changes) => {\n                self._insert_changes(&mut conflicts_finder, changes)?;\n            }\n        };\n        Ok(())\n    }\n\n    fn view_at_height(\n        &self,\n        _: &Description::Height,\n    ) -> StorageResult<KeyValueView<Self::Column, Description::Height>> {\n        // TODO: https://github.com/FuelLabs/fuel-core/issues/1995\n        Err(\n            anyhow::anyhow!(\"The historical view is not implemented for `MemoryStore`\")\n                .into(),\n        )\n    }\n\n    fn latest_view(\n        &self,\n    ) -> StorageResult<IterableKeyValueView<Self::Column, Description::Height>> {\n        let view = self.create_view();\n        Ok(IterableKeyValueView::from_storage_and_metadata(\n            IterableKeyValueViewWrapper::new(view),\n            None,\n        ))\n    }\n\n    fn rollback_block_to(&self, _: &Description::Height) -> StorageResult<()> {\n        // TODO: https://github.com/FuelLabs/fuel-core/issues/1995\n        Err(\n            anyhow::anyhow!(\"The historical view is not implemented for `MemoryStore`\")","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/FuelLabs/fuel-core/blob/b9d4d170da3a31c9ace5f963d633b326348e0d42/crates/fuel-core/src/state/in_memory/memory_store.rs#L220-L256","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Switch the database to RocksDB (database_type: DbType::RocksDb with a path) — RocksDB implements view_at_height.","Restrict memory-backed usage to latest-state queries only.","Track or upvote fuel-core issue #1995 for MemoryStore historical support."],"exampleFix":"// before\nconfig.combined_db_config.database_type = DbType::InMemory;\nlet view = db.on_chain().view_at_height(&height).await?; // errors\n\n// after\nconfig.combined_db_config.database_type = DbType::RocksDb;\nconfig.combined_db_config.path = Some(tempdir.path().into());\nlet view = db.on_chain().view_at_height(&height).await?; // works","handlingStrategy":"validation","validationCode":"use fuel_core::service::DbType;\n\nfn can_query_historical(db_type: DbType) -> bool {\n    matches!(db_type, DbType::RocksDb)\n}\n\n// before issuing historical queries\nif !can_query_historical(node_config.combined_db_config.database_type) {\n    return Err(anyhow::anyhow!(\"historical queries need a RocksDB node\"));\n}","typeGuard":"fn supports_view_at_height<Description: DatabaseDescription>(\n    db: &fuel_core::state::Database<Description>,\n) -> bool {\n    // MemoryStore has no historical view (fuel-core #1995); only RocksDB does\n    !cfg!(feature = \"rocksdb\") || db.is_rocksdb()\n}","tryCatchPattern":"match db.view_at_height(&height) {\n    Err(e) if e.to_string().contains(\"not implemented for `MemoryStore`\") => {\n        // fall back to latest_view or restart the node with database_type = RocksDb\n    }\n    rest => rest,\n}","preventionTips":["Only expose historical query endpoints on RocksDB-backed nodes.","In tests, default to RocksDB tempdirs when history-dependent code paths exist.","Gate historical API calls behind a capability check on the db type."],"tags":["database","in-memory","historical","not-implemented","fuel-core","rust"],"backgroundTag":null,"analyzedSha":"b9d4d170da3a31c9ace5f963d633b326348e0d42","analyzedAt":"2026-08-16T08:56:42.692Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}