{"record":{"id":"b75ca16f235b776b","repo":"nautechsystems/nautilus_trader","slug":"kraken-spot-does-not-support-the-demo-environment","errorCode":null,"errorMessage":"Kraken Spot does not support the demo environment","messagePattern":"Kraken Spot does not support the demo environment","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/kraken/src/common/urls.rs","lineNumber":35,"sourceCode":"\nuse super::{\n    consts::{\n        KRAKEN_FUTURES_DEMO_HTTP_URL, KRAKEN_FUTURES_DEMO_WS_URL, KRAKEN_FUTURES_HTTP_URL,\n        KRAKEN_FUTURES_WS_URL, KRAKEN_SPOT_HTTP_URL, KRAKEN_SPOT_WS_PRIVATE_URL,\n        KRAKEN_SPOT_WS_PUBLIC_URL,\n    },\n    enums::{KrakenEnvironment, KrakenProductType},\n};\n\n/// Returns the HTTP base URL for the given product type and environment.\npub fn get_kraken_http_base_url(\n    product_type: KrakenProductType,\n    environment: KrakenEnvironment,\n) -> &'static str {\n    match (product_type, environment) {\n        (KrakenProductType::Spot, KrakenEnvironment::Live) => KRAKEN_SPOT_HTTP_URL,\n        (KrakenProductType::Spot, KrakenEnvironment::Demo) => {\n            panic!(\"Kraken Spot does not support the demo environment\")\n        }\n        (KrakenProductType::Futures, KrakenEnvironment::Live) => KRAKEN_FUTURES_HTTP_URL,\n        (KrakenProductType::Futures, KrakenEnvironment::Demo) => KRAKEN_FUTURES_DEMO_HTTP_URL,\n    }\n}\n\n/// Returns the public WebSocket URL for the given product type and environment.\npub fn get_kraken_ws_public_url(\n    product_type: KrakenProductType,\n    environment: KrakenEnvironment,\n) -> &'static str {\n    match (product_type, environment) {\n        (KrakenProductType::Spot, KrakenEnvironment::Live) => KRAKEN_SPOT_WS_PUBLIC_URL,\n        (KrakenProductType::Spot, KrakenEnvironment::Demo) => {\n            panic!(\"Kraken Spot does not support the demo environment\")\n        }\n        (KrakenProductType::Futures, KrakenEnvironment::Live) => KRAKEN_FUTURES_WS_URL,\n        (KrakenProductType::Futures, KrakenEnvironment::Demo) => KRAKEN_FUTURES_DEMO_WS_URL,","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/common/urls.rs#L17-L53","documentation":"Kraken's Spot product has no demo/testnet HTTP environment; only Kraken Futures offers a demo endpoint. get_kraken_http_base_url matches on (product_type, environment) and panics for the Spot+Demo combination since there is no URL to return. The panic fires during client construction (new/with_credentials) whenever that combination is configured.","triggerScenarios":"Creating a Kraken HTTP client (new or with_credentials) or calling http_base_url with product_type=Spot and environment=Demo.","commonSituations":"A single environment setting (demo) is applied across all adapters including Kraken Spot; developers assume Kraken Spot has a testnet like Futures do; config templates copy the Futures demo setup onto Spot credentials.","solutions":["Configure environment=Live for the Kraken Spot adapter","Use the Kraken Futures adapter with Demo if you need a test environment","Add a startup config validation that rejects Spot+Demo before client construction"],"exampleFix":"// before\nenvironment = \"demo\"  # with product_type = \"spot\"\n// after\nenvironment = \"live\"  # Spot has no demo env; use Futures for demo","handlingStrategy":"validation","validationCode":"fn validate_kraken_env(p: KrakenProductType, e: KrakenEnvironment) -> Result<(), String> {\n    match (p, e) {\n        (KrakenProductType::Spot, KrakenEnvironment::Demo) =>\n            Err(\"Kraken Spot has no demo environment\".into()),\n        _ => Ok(()),\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate product_type/environment pairs at config load, not at client construction","Remember only Kraken Futures supports demo; never apply a global demo flag to Spot","Document environment support per product type in config templates"],"tags":["rust","panic","kraken","configuration","demo-environment"],"backgroundTag":"invalid-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"}