nautechsystems/nautilus_trader · error

Lighter execution client cannot modify without credentials

Error message

Lighter execution client cannot modify without credentials

What it means

modify_order was invoked while the Lighter execution client holds no API credential; order modification requires signing with account credentials, and without them the command cannot be dispatched, so the handler errors immediately.

Solutions

  1. Add the Lighter signing credential to the client config (api/private key and indexes)
  2. Confirm the env/config in the running process actually contains the key material
  3. Route modifications through a credentialed client

Example fix

// before
export LIGHTER_API_KEY=  # empty
// after
export LIGHTER_API_KEY=... LIGHTER_PRIVATE_KEY=...
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

match client.modify_order(cmd) {
    Err(e) if e.to_string().contains("cannot modify without credentials") => { /* load creds, retry */ }
    other => other?,
}

Prevention

When it happens

Trigger: Calling modify_order (amend price/quantity) on a Lighter execution client constructed without credentials.

Common situations: Credential omitted from adapter config; using the same client for read-only queries and trading; environment variables for the signing key not set in the deployment.

Related errors


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

Appendix: source

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

                    Err(e) => {
                        let reason = OrderDeniedReason::SubmitFailed {
                            detail: format!("Lighter submit_order_list failed: {e}"),
                        };
                        context
                            .emitter
                            .emit_order_denied(&order, &reason.to_string());
                    }
                }
            }
            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.

View on GitHub (pinned to 18893faf8b)