nautechsystems/nautilus_trader · error · anyhow::Error

Hyperliquid session task admission is closed: {e}

Error message

Hyperliquid session task admission is closed: {e}

What it means

Raised in connect() when obtaining a spawner from the session_tasks TaskGroup fails, meaning the group is not admitting new tasks. Without a spawner, the client cannot spawn session tasks or staged bracket children, so connect aborts with this error.

Source

Thrown at crates/adapters/hyperliquid/src/execution.rs:1734

            self.await_account_registered(30.0).await?;

            Ok::<(), anyhow::Error>(())
        };

        if let Err(e) = post_ws.await {
            log::warn!("Connect failed after WS started, tearing down: {e}");
            if let Err(teardown_error) = self.teardown_partial_connect().await {
                return Err(e.context(format!(
                    "Hyperliquid execution startup teardown failed: {teardown_error}"
                )));
            }
            return Err(e);
        }

        let session_spawner = self
            .session_tasks
            .spawner()
            .map_err(|e| anyhow::anyhow!("Hyperliquid session task admission is closed: {e}"))?;

        for parent_id in ready_bracket_parents {
            if let Some(children) = self.staged_brackets.lock().activate(&parent_id) {
                spawn_staged_children(
                    children,
                    &self.emitter,
                    &self.ws_client,
                    &self.http_client,
                    self.ws_dispatch_state.clone(),
                    self.staged_brackets.clone(),
                    self.http_client.builder_attribution(),
                    self.clock,
                    &session_spawner,
                );
            }
        }

        if let Err(e) = self.start_outcome_settlement_poll() {

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Ensure connect() is not called concurrently with teardown/shutdown of the client
  2. Check for earlier setup errors that triggered the TaskGroupGuard to begin_shutdown
  3. Retry connect after shutdown completes and the group has been reset
  4. Inspect the wrapped error for the TaskGroup's current state
Defensive patterns

Strategy: retry

Validate before calling

if client.is_disconnecting() { return; } // don't connect during shutdown

Try / catch

match client.connect().await { Err(e) if e.to_string().contains("admission is closed") => { wait_for_shutdown_complete(); retry(); }, Err(e) => return Err(e), Ok(_) => {} }

Prevention

When it happens

Trigger: After starting new generations and awaiting setup, connect() calls session_tasks.spawner(); it errors when the group's admission is closed — e.g. shutdown was triggered concurrently (via a setup guard or ws shutdown) or the generation was not actually open.

Common situations: Concurrent shutdown racing with connect; a connect attempt against a client already being torn down; the setup guard triggering begin_shutdown (e.g. on setup error) before spawner() is reached.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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