nautechsystems/nautilus_trader · error · anyhow::Error

DataActor {actor_id} registration incomplete - validation fa

Error message

DataActor {actor_id} registration incomplete - validation failed

What it means

After `register` writes trader_id, clock, and cache fields, it calls `is_properly_registered()` as an invariant check. If any of the three fields is still unset (or the check fails), registration is deemed incomplete and the actor bails rather than operating with a half-initialized state.

Source

Thrown at crates/common/src/actor/data_actor.rs:4151

        }

        // Validate clock by attempting to access it
        {
            let _timestamp = clock.borrow().timestamp_ns();
        }

        // Validate cache by attempting to access it
        {
            let _cache_borrow = cache.borrow();
        }

        self.trader_id = Some(trader_id);
        self.clock = Some(clock);
        self.cache = Some(cache);

        // Verify complete registration
        if !self.is_properly_registered() {
            anyhow::bail!(
                "DataActor {} registration incomplete - validation failed",
                self.actor_id
            );
        }

        log::debug!("Registered {} with trader {trader_id}", self.actor_id);
        Ok(())
    }

    /// Register an event type for warning log levels.
    pub fn register_warning_event(&mut self, event_type: &str) {
        self.warning_events.insert(event_type.to_string());
        log::debug!("Registered event type '{event_type}' for warning logs");
    }

    /// Deregister an event type from warning log levels.
    pub fn deregister_warning_event(&mut self, event_type: &str) {
        self.warning_events.remove(event_type);

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Inspect `is_properly_registered()` and ensure trader_id, clock, and cache are all set before the check
  2. Use the standard `register` entry point rather than setting fields manually
  3. Check custom subclasses for overrides that clear or skip the clock/cache fields
Defensive patterns

Strategy: try-catch

Validate before calling

debug_assert!(trader_id_set && clock_set && cache_set, "all registration inputs required");

Try / catch

actor.register(trader_id, clock, cache).map_err(|e| {
    eprintln!("registration incomplete: {e}; check is_properly_registered conditions");
    e
})?;

Prevention

When it happens

Trigger: A registration call where validation passed but post-assignment state does not satisfy `is_properly_registered()` — e.g. an internal path clearing one of trader_id/clock/cache, or a subclass overriding registration bookkeeping incorrectly.

Common situations: Custom actor subclasses that override or interfere with registration fields; partial registration followed by a retry where state was cleared; an internal bug where clock/cache references were dropped before verification.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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