{"record":{"id":"e9a944044f817204","repo":"nautechsystems/nautilus_trader","slug":"lighter-execution-client-cannot-cancel-without-cre","errorCode":null,"errorMessage":"Lighter execution client cannot cancel without credentials","messagePattern":"Lighter execution client cannot cancel without credentials","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/execution.rs","lineNumber":4369,"sourceCode":"                }\n            }\n            Ok(())\n        });\n\n        Ok(())\n    }\n\n    fn modify_order(&self, cmd: ModifyOrder) -> anyhow::Result<()> {\n        let credential = self.credential.as_ref().ok_or_else(|| {\n            anyhow::anyhow!(\"Lighter execution client cannot modify without credentials\")\n        })?;\n        self.dispatch_signed_modify_order(&cmd, credential);\n        Ok(())\n    }\n\n    fn cancel_order(&self, cmd: CancelOrder) -> anyhow::Result<()> {\n        let credential = self.credential.as_ref().ok_or_else(|| {\n            anyhow::anyhow!(\"Lighter execution client cannot cancel without credentials\")\n        })?;\n        self.dispatch_signed_cancel_order(&cmd, credential);\n        Ok(())\n    }\n\n    fn cancel_all_orders(&self, cmd: CancelAllOrders) -> anyhow::Result<()> {\n        // Iterate over open orders for the instrument and cancel each. The\n        // venue offers a `CancelAllOrders` tx but it spans the whole account\n        // rather than a single market; doing per-order cancels keeps scope\n        // tight and avoids cancelling positions in unrelated markets.\n        let cache = self.core.cache();\n        let open_orders: Vec<ClientOrderId> = cache\n            .orders_open(None, Some(&cmd.instrument_id), None, None, None)\n            .into_iter()\n            .map(|o| o.client_order_id())\n            .collect();\n\n        for client_order_id in open_orders {","sourceCodeStart":4351,"sourceCodeEnd":4387,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/execution.rs#L4351-L4387","documentation":"cancel_order was invoked while the Lighter execution client holds no API credential; cancellation requires signing with account credentials, and without them the command cannot be dispatched, so the handler errors immediately.","triggerScenarios":"Calling cancel_order on a credential-less Lighter execution client — e.g. trying to cancel an order from a read-only client instance.","commonSituations":"Missing API key config; forgetting credentials when instantiating the adapter in tests or staging; credentials removed after auth failure.","solutions":["Configure credentials on the client that performs cancels","Verify the credential field is populated before order management calls","Use the same credentialed client that submitted the order to cancel it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if client.credential().is_none() {\n    return Err(anyhow!(\"cannot cancel order: credentials missing\"));\n}","typeGuard":"fn has_credential(c: &LighterExecutionClient) -> bool {\n    c.credential().is_some()\n}","tryCatchPattern":"match client.cancel_order(cmd) {\n    Err(e) if e.to_string().contains(\"cannot cancel without credentials\") => { /* configure credentials */ }\n    other => other?,\n}","preventionTips":["Use the submitting client (credentialed) for cancels","Check credential presence in health checks before the trading session","Keep key config in one place so staging/CI don't silently omit it"],"tags":["rust","lighter","credentials","cancel-order"],"backgroundTag":"missing-credentials","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"}