nautechsystems/nautilus_trader · error · anyhow::Error
failed to register Polymarket resolve poll: {e}
Error message
failed to register Polymarket resolve poll: {e} What it means
Thrown when tasks.spawn(future) fails while registering the resolve-poll background task in register_resolve_poll_task. The task group refused admission (closed/shutting down), so connect() aborts rather than run a data client missing resolution polling.
Source
Thrown at crates/adapters/polymarket/src/data/lifecycle.rs:412
continue;
}
let _ = fetch_and_apply_resolutions_by_condition_ids(
&gamma_client,
&clob_public_client,
&resolve_ctx,
&selection.condition_ids,
ResolveBatchErrorMode::Continue,
false,
)
.await;
}
}
}
};
self.tasks
.spawn(future)
.map_err(|e| anyhow::anyhow!("failed to register Polymarket resolve poll: {e}"))?;
Ok(())
}
pub(super) async fn await_tasks_with_timeout(
&self,
timeout: tokio::time::Duration,
) -> anyhow::Result<()> {
self.tasks.begin_shutdown();
let graceful_timeout = (timeout / 2).min(TASK_GRACEFUL_SHUTDOWN_TIMEOUT);
let abort_timeout = timeout.saturating_sub(graceful_timeout);
self.tasks
.finish_shutdown(graceful_timeout, abort_timeout)
.await
.map_err(|e| anyhow::anyhow!("Failed to terminate Polymarket data tasks: {e}"))?;
Ok(())
}
pub(super) fn start_client(&mut self) {View on GitHub (pinned to 18893faf8b)
Solutions
- Serialize lifecycle calls; wait for disconnect to fully finish before reconnecting
- Retry connect() so start_generation() reopens the task group
- Verify the runtime is not being dropped during connect
Defensive patterns
Strategy: try-catch
Try / catch
match client.connect().await {
Err(e) if e.to_string().contains("failed to register Polymarket resolve poll") => {
// retry on a fresh generation
client.connect().await.context("resolve poll registration failed twice")?;
}
r => r?,
} Prevention
- Keep lifecycle calls serialized per client
- Ensure the runtime is not shutting down during connect
- If repeated, rebuild the client rather than reusing a wedged task group
When it happens
Trigger: tasks.spawn() returns Err during connect_client's registration phase — task group closed by concurrent shutdown or runtime teardown between spawner acquisition and spawn.
Common situations: Disconnect racing connect; process shutting down mid-connect; earlier registration failure closed the generation window.
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
- failed to register Polymarket instrument refresh: {e}
- Failed to start RTDS message loop: {e}; startup rollback fai
- Failed to start Polymarket WebSocket handler task: {e}
- Failed to register Betfair keep-alive task: {e}
- Failed to register Betfair reconnect task: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/825abf6536b263fa.
Report an issue: GitHub.