{"record":{"id":"8645389dd54be5ac","repo":"nautechsystems/nautilus_trader","slug":"invalid-config-type-for-coinbaseexecutionclientfac","errorCode":null,"errorMessage":"Invalid config type for CoinbaseExecutionClientFactory. Expected CoinbaseExecutionClientConfig, was {config:?}","messagePattern":"Invalid config type for CoinbaseExecutionClientFactory\\. Expected CoinbaseExecutionClientConfig, was (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/coinbase/src/factories.rs","lineNumber":151,"sourceCode":"    #[must_use]\n    pub const fn new() -> Self {\n        Self\n    }\n}\n\nimpl ExecutionClientFactory for CoinbaseExecutionClientFactory {\n    fn create(\n        &self,\n        trader_id: TraderId,\n        name: &str,\n        config: &dyn ClientConfig,\n        cache: CacheView,\n    ) -> anyhow::Result<Box<dyn ExecutionClient>> {\n        let coinbase_config = config\n            .as_any()\n            .downcast_ref::<CoinbaseExecutionClientConfig>()\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"Invalid config type for CoinbaseExecutionClientFactory. Expected CoinbaseExecutionClientConfig, was {config:?}\",\n                )\n            })?\n            .clone();\n\n        let account_type = coinbase_config.account_type;\n        if !matches!(account_type, AccountType::Cash | AccountType::Margin) {\n            anyhow::bail!(\n                \"Unsupported account_type {account_type:?} for Coinbase; expected Cash (spot) or Margin (CFM derivatives)\"\n            );\n        }\n\n        let core = ExecutionClientCore::new(\n            trader_id,\n            ClientId::from(name),\n            *COINBASE_VENUE,\n            OmsType::Netting,\n            coinbase_config.account_id,","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/coinbase/src/factories.rs#L133-L169","documentation":"CoinbaseExecutionClientFactory::create downcasts the generic ClientConfig to CoinbaseExecutionClientConfig; on failure it raises this error. It guards that execution clients are only built from the execution-specific config type.","triggerScenarios":"Calling the execution factory's create() with a CoinbaseDataClientConfig or any non-matching config type, or tests passing a wrong/unsupported config deliberately.","commonSituations":"Config file sections swapped between data and execution clients, a custom config struct used instead of CoinbaseExecutionClientConfig, or adapter version drift after refactors.","solutions":["Supply CoinbaseExecutionClientConfig to the execution factory's create().","Confirm your node config's execution-client block parses into CoinbaseExecutionClientConfig.","Check that the factory you registered matches the config type you pass (data vs execution).","Update custom config structs to embed/derive from CoinbaseExecutionClientConfig."],"exampleFix":"// before\nexec_factory.create(name, &data_config, ...)?;\n// after\nlet exec_config = CoinbaseExecutionClientConfig { account_type: CoinbaseAccountType::Cash, .. };\nexec_factory.create(name, &exec_config, ...)?;","handlingStrategy":"type-guard","validationCode":"let is_exec_cfg = config.as_any().downcast_ref::<CoinbaseExecutionClientConfig>().is_some();\nif !is_exec_cfg { /* fix config wiring before calling the execution factory */ }","typeGuard":"fn is_coinbase_exec_config(config: &dyn ClientConfig) -> bool {\n    config.as_any().downcast_ref::<CoinbaseExecutionClientConfig>().is_some()\n}","tryCatchPattern":null,"preventionTips":["Use CoinbaseExecutionClientConfig (with account_type) for execution clients only.","Verify factory/config pairing in your node builder code.","Add a startup smoke test that constructs each client from parsed config."],"tags":["config","downcast","type-mismatch","factory"],"backgroundTag":"config-type-mismatch","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}