clockworklabs/SpacetimeDB · error

DbConnectionBuilder can only register a single `on_connect_e

Error message

DbConnectionBuilder can only register a single `on_connect_error` callback.

Instead of registering multiple `on_connect_error` callbacks, register a single callback which does multiple operations.

What it means

Error "DbConnectionBuilder can only register a single `on_connect_error` callback. Instead of registering multiple `on_connect_error` callbacks, register a single callback which does multiple operations." thrown in clockworklabs/SpacetimeDB.

Source

Thrown at sdks/rust/src/db_connection.rs:1164

            panic!(
                "DbConnectionBuilder can only register a single `on_connect` callback.

Instead of registering multiple `on_connect` callbacks, register a single callback which does multiple operations."
            );
        }

        self.on_connect = Some(Box::new(callback));
        self
    }

    /// Register a callback to run when a connection attempt fails asynchronously.
    ///
    /// This callback is invoked only before the initial connection message is
    /// received from the host. Errors which prevent [`Self::build`] from creating
    /// a connection are returned by [`Self::build`] instead.
    pub fn on_connect_error(mut self, callback: impl FnOnce(&M::ErrorContext, crate::Error) + Send + 'static) -> Self {
        if self.on_connect_error.is_some() {
            panic!(
                "DbConnectionBuilder can only register a single `on_connect_error` callback.

Instead of registering multiple `on_connect_error` callbacks, register a single callback which does multiple operations."
            );
        }

        self.on_connect_error = Some(Box::new(callback));
        self
    }

    /// Register a callback to run when an established connection is closed.
    ///
    /// The connection is established after the initial connection message is
    /// received from the host. Connection failures before that point invoke
    /// [`Self::on_connect_error`] instead.
    pub fn on_disconnect(
        mut self,
        callback: impl FnOnce(&M::ErrorContext, Option<crate::Error>) + Send + 'static,

View on GitHub (pinned to 6dee26c6ef)

When it happens

Trigger: Thrown at sdks/rust/src/db_connection.rs:1164 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20). Data as JSON: /api/errors/8a0ccec0294c9838. Report an issue: GitHub.