{"record":{"id":"2e3c1416d0ecc181","repo":"nautechsystems/nautilus_trader","slug":"gateway-feature-is-not-enabled-build-with-featu","errorCode":null,"errorMessage":"Gateway feature is not enabled. Build with --features gateway","messagePattern":"Gateway feature is not enabled\\. Build with --features gateway","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/gateway/dockerized.rs","lineNumber":554,"sourceCode":"            }\n        }\n\n        Ok(())\n    }\n}\n\n/// Stub implementation when gateway feature is disabled.\n#[cfg(not(feature = \"gateway\"))]\n#[derive(Debug)]\npub struct DockerizedIBGateway;\n\n#[cfg(not(feature = \"gateway\"))]\nimpl DockerizedIBGateway {\n    /// # Errors\n    ///\n    /// Returns an error if the Dockerized IB Gateway cannot be created or started.\n    pub fn new(_config: crate::config::DockerizedIBGatewayConfig) -> anyhow::Result<Self> {\n        anyhow::bail!(\"Gateway feature is not enabled. Build with --features gateway\")\n    }\n}\n\n#[cfg(all(test, feature = \"gateway\"))]\nmod tests {\n    use rstest::rstest;\n\n    use super::DockerizedIBGateway;\n    use crate::config::TradingMode;\n\n    #[rstest]\n    #[case(TradingMode::Paper, 4002)]\n    #[case(TradingMode::Live, 4001)]\n    fn host_port_matches_trading_mode(#[case] trading_mode: TradingMode, #[case] expected: u16) {\n        assert_eq!(\n            DockerizedIBGateway::host_port_for_mode(trading_mode),\n            expected\n        );","sourceCodeStart":536,"sourceCodeEnd":572,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/gateway/dockerized.rs#L536-L572","documentation":"DockerizedIBGateway's real Docker-backed implementation is behind the optional `gateway` cargo feature. Without it, a stub impl is compiled whose new() unconditionally bails, so any attempt to construct a dockerized gateway fails at runtime.","triggerScenarios":"Calling DockerizedIBGateway::new(config) in a build compiled without --features gateway (the cfg(not(feature = \"gateway\")) stub at dockerized.rs:554).","commonSituations":"Running examples/binaries or tests with default features after writing code that uses the dockerized gateway; CI builds that omit the feature flag; forgetting the feature in Cargo.toml dependency declaration.","solutions":["Rebuild with the feature enabled: cargo build --features gateway (or cargo test -p nautilus-interactive-brokers --features gateway)\nAdd the feature to the dependency declaration: nautilus-adapters = { version = \"...\", features = [\"gateway\"] } or enable it via a workspace feature\nGate your code with #[cfg(feature = \"gateway\")] so it compiles/fails clearly when the feature is absent"],"exampleFix":"// before\ncargo build -p nautilus-interactive-brokers\n// after\ncargo build -p nautilus-interactive-brokers --features gateway","handlingStrategy":"fallback","validationCode":"#[cfg(not(feature = \"gateway\"))]\ncompile_error!(\"This binary requires the `gateway` feature\");","typeGuard":null,"tryCatchPattern":"match DockerizedIBGateway::new(config) {\n    Err(e) if e.to_string().contains(\"Gateway feature is not enabled\") => {\n        anyhow::bail!(\"rebuild with --features gateway to use the dockerized gateway\");\n    }\n    r => r,\n}","preventionTips":["Enable the `gateway` feature in Cargo.toml for any binary that uses DockerizedIBGateway","Add a CI build with --features gateway to catch feature omissions","Document the required feature flag in your deployment/runbook"],"tags":["rust","feature-flags","docker","interactive-brokers"],"backgroundTag":"feature-not-enabled","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"}