{"record":{"id":"406783242c241d2b","repo":"nautechsystems/nautilus_trader","slug":"unsupported-account-type-account-type-for-coin","errorCode":null,"errorMessage":"Unsupported account_type {account_type:?} for Coinbase; expected Cash (spot) or Margin (CFM derivatives)","messagePattern":"Unsupported account_type (.+?) for Coinbase; expected Cash \\(spot\\) or Margin \\(CFM derivatives\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/coinbase/src/factories.rs","lineNumber":159,"sourceCode":"        &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,\n            account_type,\n            None,\n            cache,\n        );\n\n        let client = CoinbaseExecutionClient::new(core, coinbase_config)?;\n\n        Ok(Box::new(client))","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/coinbase/src/factories.rs#L141-L177","documentation":"The Coinbase execution client factory only accepts AccountType::Cash (spot trading) or AccountType::Margin (CFM derivatives). Any other account_type in the CoinbaseExecClientConfig is rejected at client creation with this error.","triggerScenarios":"Constructing a Coinbase execution client via the factory with config.account_type set to e.g. AccountType::CashAndMargin, Futures, or another variant unsupported by the venue.","commonSituations":"Copying a config from another adapter whose account_type variant differs; typos/serialization producing an unexpected enum value; assuming Coinbase supports margin+futures combined account modes.","solutions":["Set account_type to AccountType::Cash for spot trading","Set account_type to AccountType::Margin for CFM (derivatives) trading","Validate the config enum value before passing it to the factory","Use the dedicated Coinbase execution client config type (not a generic one) so deserialization constrains the field"],"exampleFix":"// before\nlet config = CoinbaseExecClientConfig { account_type: AccountType::Futures, .. };\n\n// after\nlet config = CoinbaseExecClientConfig { account_type: AccountType::Margin, .. }; // or AccountType::Cash","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["config","account-type","factory","rust"],"backgroundTag":"unsupported-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}