{"record":{"id":"85ab906cfb4a6fef","repo":"nautechsystems/nautilus_trader","slug":"non-zero","errorCode":null,"errorMessage":"non-zero","messagePattern":"non-zero","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"crates/adapters/coinbase/src/http/client.rs","lineNumber":95,"sourceCode":"            OrdersListResponse, ProductsResponse,\n        },\n        parse::{\n            parse_account_state, parse_cfm_account_state, parse_cfm_margin_balances,\n            parse_cfm_position_status_report, parse_fill_report, parse_instrument,\n            parse_order_status_report,\n        },\n        query::{\n            CancelOrdersRequest, CreateOrderRequest, EditOrderRequest, FillListQuery, LimitFok,\n            LimitFokParams, LimitGtc, LimitGtcParams, LimitGtd, LimitGtdParams, MarketFok,\n            MarketIoc, MarketParams, OrderConfiguration, OrderListQuery, StopLimitGtc,\n            StopLimitGtcParams, StopLimitGtd, StopLimitGtdParams,\n        },\n    },\n};\n\n/// Default Coinbase Advanced Trade REST rate limit (30 requests per second).\npub static COINBASE_REST_QUOTA: LazyLock<Quota> = LazyLock::new(|| {\n    Quota::per_second(NonZeroU32::new(30).expect(\"non-zero\")).expect(\"valid constant\")\n});\n\n/// Returns the default retry configuration for the Coinbase HTTP client.\n#[must_use]\npub fn default_retry_config() -> RetryConfig {\n    RetryConfig {\n        max_retries: 3,\n        initial_delay_ms: 100,\n        max_delay_ms: 5_000,\n        backoff_factor: 2.0,\n        jitter_ms: 250,\n        operation_timeout_ms: Some(60_000),\n        immediate_first: false,\n        max_elapsed_ms: Some(180_000),\n    }\n}\n\n/// Returns the retry configuration for the Coinbase data client.","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/coinbase/src/http/client.rs#L77-L113","documentation":"This is a compile-time-constant sanity check: COINBASE_REST_QUOTA builds a governor Quota of 30 requests/second and asserts 30 is non-zero before passing it to Quota::per_second. Quota::per_second requires a NonZeroU32, so the constant is wrapped with NonZeroU32::new and unwrapped with expect. This panic can never fire in practice because 30 is a literal non-zero.","triggerScenarios":"Only if the source constant 30 were changed to 0 and the code were executed for the first time (LazyLock initialization).","commonSituations":"Developers editing the rate-limit constant to throttle the client and accidentally setting it to 0 will hit this panic on first use of the quota.","solutions":["Keep the constant non-zero; if throttling to zero is intended, disable the quota/guard instead of setting 0.","Use Quota::per_second(NonZeroU32::MAX) style or a const assertion if you want the mistake caught at compile time."],"exampleFix":"// before\nQuota::per_second(NonZeroU32::new(0).expect(\"non-zero\")) // panics at init\n// after\nQuota::per_second(NonZeroU32::new(30).expect(\"non-zero\"))","handlingStrategy":"validation","validationCode":"// Not applicable to library users; maintainers should keep the literal non-zero:\nconst REST_RPS: u32 = 30;\nassert!(REST_RPS > 0);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never set rate-limit constants to 0 expecting a 'disable' effect.","Treat this panic as a signal that a constant was mis-edited."],"tags":["rust","rate-limit","panic","coinbase","constant"],"backgroundTag":"internal-invariant-violation","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"}