nautechsystems/nautilus_trader · error

Lighter does not support TimeInForce::{other:?}

Error message

Lighter does not support TimeInForce::{other:?}

What it means

Catch-all for TimeInForce values the Lighter adapter does not recognize in the general TIF translation path. Accepted values are Ioc (ImmediateOrCancel), Gtc/Day/Gtd (GoodTillTime); Fok has a dedicated error; everything else lands here.

Source

Thrown at crates/adapters/lighter/src/websocket/dispatch.rs:2026

            ),
            TimeInForce::Fok => anyhow::bail!(
                "Lighter has no fill-or-kill TIF; reject FOK at the strategy or use IOC explicitly",
            ),
            other => anyhow::bail!(
                "Lighter conditional market orders do not support TimeInForce::{other:?}",
            ),
        };
    }

    match tif {
        TimeInForce::Ioc => Ok(LighterTimeInForce::ImmediateOrCancel),
        TimeInForce::Fok => anyhow::bail!(
            "Lighter has no fill-or-kill TIF; reject FOK at the strategy or use IOC explicitly",
        ),
        TimeInForce::Gtc | TimeInForce::Day | TimeInForce::Gtd => {
            Ok(LighterTimeInForce::GoodTillTime)
        }
        other => anyhow::bail!("Lighter does not support TimeInForce::{other:?}"),
    }
}

/// Translate a Nautilus [`OrderType`] into the venue's [`LighterOrderType`]
/// discriminant for use in `CreateOrder` tx bodies.
pub(crate) fn nautilus_to_lighter_order_type(
    order_type: OrderType,
) -> anyhow::Result<LighterOrderType> {
    LighterOrderType::try_from(order_type)
        .map_err(|e| anyhow::anyhow!("unsupported Nautilus order type for Lighter: {e}"))
}

/// Compute the venue-side `order_expiry` (millis) for a Nautilus order.
///
/// - `MARKET`: `ORDER_EXPIRY_IOC` (`0`) because it has no resting trigger
///   lifetime.
/// - Conditional orders: positive expiry from `GTD` or the default GTC window.
///   Lighter uses `TimeInForce` as the post-trigger execution instruction,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Restrict configured/allowed TIFs to Gtc, Ioc, Day, or Gtd for Lighter
  2. Whitelist TIF values in strategy config parsing before order creation
  3. Update the adapter match when new TimeInForce variants must be supported
Defensive patterns

Strategy: validation

Validate before calling

// Rust
fn lighter_tif_supported(tif: TimeInForce) -> bool {
    matches!(tif, TimeInForce::Ioc | TimeInForce::Gtc | TimeInForce::Day | TimeInForce::Gtd)
}

Type guard

fn is_supported_lighter_tif(tif: TimeInForce) -> bool {
    matches!(tif, TimeInForce::Ioc | TimeInForce::Gtc | TimeInForce::Day | TimeInForce::Gtd)
}

Prevention

When it happens

Trigger: Submitting a Lighter order with any TimeInForce outside {Ioc, Fok, Gtc, Day, Gtd} — e.g. AtTheOpen, AtTheClose, or Auction variants.

Common situations: A Nautilus version bump introducing new TimeInForce variants; strategy code constructing TimeInForce dynamically from config that lets arbitrary values through.

Related errors


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