{"record":{"id":"e0278e9a35ac5390","repo":"nautechsystems/nautilus_trader","slug":"invalid-config-type-for-hyperliquidexecutionclient","errorCode":null,"errorMessage":"Invalid config type for HyperliquidExecutionClientFactory. Expected HyperliquidExecutionClientConfig, was {config:?}","messagePattern":"Invalid config type for HyperliquidExecutionClientFactory\\. Expected HyperliquidExecutionClientConfig, was (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/hyperliquid/src/factories.rs","lineNumber":147,"sourceCode":"impl Default for HyperliquidExecutionClientFactory {\n    fn default() -> Self {\n        Self::new()\n    }\n}\n\nimpl ExecutionClientFactory for HyperliquidExecutionClientFactory {\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 hyperliquid_config = config\n            .as_any()\n            .downcast_ref::<HyperliquidExecutionClientConfig>()\n            .ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"Invalid config type for HyperliquidExecutionClientFactory. Expected HyperliquidExecutionClientConfig, was {config:?}\",\n                )\n            })?\n            .clone();\n\n        // Hyperliquid uses netting for perpetual futures\n        let oms_type = OmsType::Netting;\n\n        // Hyperliquid is always margin (perpetual futures)\n        let account_type = AccountType::Margin;\n\n        let core = ExecutionClientCore::new(\n            trader_id,\n            ClientId::from(name),\n            *HYPERLIQUID_VENUE,\n            oms_type,\n            hyperliquid_config.account_id,\n            account_type,","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/hyperliquid/src/factories.rs#L129-L165","documentation":"HyperliquidExecutionClientFactory::create() downcasts the generic config to HyperliquidExecutionClientConfig and fails when the provided config is any other type. This mirrors the data factory check on the execution side.","triggerScenarios":"Passing a HyperliquidDataClientConfig (or any other config type) to the execution client factory — usually a miswired client registration in the TradingNode builder or wrong config section in the JSON/TOML config.","commonSituations":"Swapping data and execution config objects when wiring clients programmatically; config file sections deserialized into the wrong struct; reusing one config object for both factories.","solutions":["Ensure the config passed to HyperliquidExecutionClientFactory is a HyperliquidExecutionClientConfig","Check .exec_clients(...) wiring pairs the exec factory with an execution config","Fix the config file so the execution client section deserializes into HyperliquidExecutionClientConfig","Use the {config:?} in the message to identify the actual type passed"],"exampleFix":"// before\nnode_builder.add_exec_client_factory(\"HYPERLIQUID\", HyperliquidExecutionClientFactory(), data_config);\n// after\nnode_builder.add_exec_client_factory(\"HYPERLIQUID\", HyperliquidExecutionClientFactory(), exec_config);","handlingStrategy":"type-guard","validationCode":"if config.as_any().downcast_ref::<HyperliquidExecutionClientConfig>().is_none() {\n    panic!(\"exec client config must be HyperliquidExecutionClientConfig\");\n}","typeGuard":"fn is_exec_config(config: &dyn ClientConfig) -> bool {\n    config.as_any().downcast_ref::<HyperliquidExecutionClientConfig>().is_some()\n}","tryCatchPattern":"match factory.create(name, config, cache, clock) { Err(e) if e.to_string().contains(\"Invalid config type\") => fix_client_wiring(), other => other }","preventionTips":["Pair HyperliquidExecutionClientFactory only with HyperliquidExecutionClientConfig","Do not reuse a single config object for both data and execution factories","Verify the exec client section of the config file deserializes to the exec config struct","Check the {config:?} debug output when the error fires"],"tags":["config","factory","hyperliquid","downcast"],"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-14T00:17:10.932Z"}