nautechsystems/nautilus_trader · error

Lighter execution client cannot cancel without credentials

Error message

Lighter execution client cannot cancel without credentials

What it means

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.

Source

Thrown at crates/adapters/lighter/src/execution.rs:4369

                }
            }
            Ok(())
        });

        Ok(())
    }

    fn modify_order(&self, cmd: ModifyOrder) -> anyhow::Result<()> {
        let credential = self.credential.as_ref().ok_or_else(|| {
            anyhow::anyhow!("Lighter execution client cannot modify without credentials")
        })?;
        self.dispatch_signed_modify_order(&cmd, credential);
        Ok(())
    }

    fn cancel_order(&self, cmd: CancelOrder) -> anyhow::Result<()> {
        let credential = self.credential.as_ref().ok_or_else(|| {
            anyhow::anyhow!("Lighter execution client cannot cancel without credentials")
        })?;
        self.dispatch_signed_cancel_order(&cmd, credential);
        Ok(())
    }

    fn cancel_all_orders(&self, cmd: CancelAllOrders) -> anyhow::Result<()> {
        // Iterate over open orders for the instrument and cancel each. The
        // venue offers a `CancelAllOrders` tx but it spans the whole account
        // rather than a single market; doing per-order cancels keeps scope
        // tight and avoids cancelling positions in unrelated markets.
        let cache = self.core.cache();
        let open_orders: Vec<ClientOrderId> = cache
            .orders_open(None, Some(&cmd.instrument_id), None, None, None)
            .into_iter()
            .map(|o| o.client_order_id())
            .collect();

        for client_order_id in open_orders {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Configure credentials on the client that performs cancels
  2. Verify the credential field is populated before order management calls
  3. Use the same credentialed client that submitted the order to cancel it
Defensive patterns

Strategy: validation

Validate before calling

if client.credential().is_none() {
    return Err(anyhow!("cannot cancel order: credentials missing"));
}

Type guard

fn has_credential(c: &LighterExecutionClient) -> bool {
    c.credential().is_some()
}

Try / catch

match client.cancel_order(cmd) {
    Err(e) if e.to_string().contains("cannot cancel without credentials") => { /* configure credentials */ }
    other => other?,
}

Prevention

When it happens

Trigger: Calling cancel_order on a credential-less Lighter execution client — e.g. trying to cancel an order from a read-only client instance.

Common situations: Missing API key config; forgetting credentials when instantiating the adapter in tests or staging; credentials removed after auth failure.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/e9a944044f817204. Report an issue: GitHub.