{"record":{"id":"00acc74bf0c52573","repo":"nautechsystems/nautilus_trader","slug":"kraken-spot-does-not-support-the-demo-environment-00acc7","errorCode":null,"errorMessage":"Kraken Spot does not support the demo environment","messagePattern":"Kraken Spot does not support the demo environment","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/config.rs","lineNumber":310,"sourceCode":"    ///\n    /// Returns an error if `default_leverage` is set on a Cash account or the demo environment is\n    /// used for Spot.\n    pub fn validate(&self) -> anyhow::Result<()> {\n        validate_product_environment(self.product_type, self.environment)?;\n\n        if self.default_leverage.is_some() && self.spot_account_type == AccountType::Cash {\n            anyhow::bail!(\"default_leverage requires spot_account_type=Margin\");\n        }\n        Ok(())\n    }\n}\n\nfn validate_product_environment(\n    product_type: KrakenProductType,\n    environment: KrakenEnvironment,\n) -> anyhow::Result<()> {\n    if product_type == KrakenProductType::Spot && environment == KrakenEnvironment::Demo {\n        anyhow::bail!(\"Kraken Spot does not support the demo environment\");\n    }\n    Ok(())\n}\n\n#[cfg(test)]\nmod tests {\n    use rstest::rstest;\n\n    use super::*;\n\n    const DATA_API_KEY: &str = \"data-api-key-sentinel\";\n    const DATA_API_SECRET: &str = \"data-api-secret-sentinel\";\n    const EXEC_API_KEY: &str = \"exec-api-key-sentinel\";\n    const EXEC_API_SECRET: &str = \"exec-api-secret-sentinel\";\n\n    #[rstest]\n    fn test_data_config_debug_redacts_credentials() {\n        let config = KrakenDataClientConfig {","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/config.rs#L292-L328","documentation":"Environment validation in Kraken clients: the demo (testnet-style) environment was selected while product_type is Spot. Kraken Spot has no demo environment, so the combination is rejected during configuration validation.","triggerScenarios":"Configuring the Kraken adapter with `product_type: Spot` and `environment: Demo`; caught when the config's `validate()` (via `validate_product_environment`) runs during client construction.","commonSituations":"Reusing a Futures demo config for Spot; assuming a Spot paper-trading endpoint exists; testing setups copied from other adapters.","solutions":["Set `environment` to Live (or the supported sandbox value) for Spot, or","Switch `product_type` to Futures if the demo environment is actually needed","Call validate() early to fail fast before connecting"],"exampleFix":"// before\nlet config = KrakenDataClientConfig {\n    product_type: KrakenProductType::Spot,\n    environment: KrakenEnvironment::Demo,\n    ..Default::default()\n};\n// after\nlet config = KrakenDataClientConfig {\n    product_type: KrakenProductType::Spot,\n    environment: KrakenEnvironment::Live,\n    ..Default::default()\n};","handlingStrategy":"validation","validationCode":"if product_type == KrakenProductType::Spot && environment == KrakenEnvironment::Demo {\n    panic!(\"Spot+Demo is not supported by Kraken\");\n}\ncfg.validate().expect(\"invalid Kraken config\");","typeGuard":null,"tryCatchPattern":"config.validate().unwrap_or_else(|e| {\n    eprintln!(\"Kraken config invalid: {e}\");\n    std::process::exit(1);\n});","preventionTips":["Validate configs at process start, before any client construction","Remember Kraken has no Spot demo; use Futures demo or a live test account","Keep environment/product combinations in named config profiles"],"tags":["rust","kraken-spot","config-validation","demo-environment"],"backgroundTag":"unsupported-config-value","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"}