nautechsystems/nautilus_trader · error
Unsupported account_type {account_type:?} for Coinbase; expe
Error message
Unsupported account_type {account_type:?} for Coinbase; expected Cash (spot) or Margin (CFM derivatives) What it means
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.
Source
Thrown at crates/adapters/coinbase/src/factories.rs:159
&self,
trader_id: TraderId,
name: &str,
config: &dyn ClientConfig,
cache: CacheView,
) -> anyhow::Result<Box<dyn ExecutionClient>> {
let coinbase_config = config
.as_any()
.downcast_ref::<CoinbaseExecutionClientConfig>()
.ok_or_else(|| {
anyhow::anyhow!(
"Invalid config type for CoinbaseExecutionClientFactory. Expected CoinbaseExecutionClientConfig, was {config:?}",
)
})?
.clone();
let account_type = coinbase_config.account_type;
if !matches!(account_type, AccountType::Cash | AccountType::Margin) {
anyhow::bail!(
"Unsupported account_type {account_type:?} for Coinbase; expected Cash (spot) or Margin (CFM derivatives)"
);
}
let core = ExecutionClientCore::new(
trader_id,
ClientId::from(name),
*COINBASE_VENUE,
OmsType::Netting,
coinbase_config.account_id,
account_type,
None,
cache,
);
let client = CoinbaseExecutionClient::new(core, coinbase_config)?;
Ok(Box::new(client))View on GitHub (pinned to 18893faf8b)
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
Example fix
// before
let config = CoinbaseExecClientConfig { account_type: AccountType::Futures, .. };
// after
let config = CoinbaseExecClientConfig { account_type: AccountType::Margin, .. }; // or AccountType::Cash Defensive patterns
Strategy: validation
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid config type for AxExecutionClientFactory. Expected A
- Invalid config type for BlockchainDataClientFactory. Expecte
- Invalid config type for BlockchainExecutionClientFactory. Ex
- Invalid config type for DatabentoDataClientFactory. Expected
- Invalid config type for DeribitDataClientFactory. Expected D
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/406783242c241d2b.
Report an issue: GitHub.