clockworklabs/SpacetimeDB · error · DBError

no such module

Error message

no such module

What it means

call_sql_command dispatches to the module host actor via call_instance!; when the instance cannot be reached (stopped, crashed, or never started), every failure is mapped via .map_err(|_| ...) to DBError::Other('no such module'). The mapping discards the original error, so the real cause (e.g. why the actor died) exists only in host logs.

Solutions

  1. Check host logs for the module actor's actual failure - this message hides it.
  2. Ensure the database is published and its module instance is running before issuing SQL.
  3. Retry with backoff if the command raced a module restart.
  4. Avoid running SQL concurrently with publish/update of the same database.
Defensive patterns

Strategy: validation

Validate before calling

if !host_controller.module_running(db_addr).await {
    return Err(anyhow::anyhow!("module for {db_addr} is not running; publish first"));
}

Try / catch

Match on DBError::Other with message 'no such module' and treat it as 'module unavailable': surface a retryable health-check signal rather than a SQL error, and check host logs for the real cause.

Prevention

When it happens

Trigger: Issuing a SQL command while the module actor has crashed or is restarting; targeting a database whose module was never spawned; calling SQL during the publish/update teardown window.

Common situations: A module crash-looping after a bad publish; a race between database creation and the first SQL command; host shutdown draining in-flight commands.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@eddf9f5014 (2026-08-20). Data as JSON: /api/errors/2e1649da77cd1c34. Report an issue: GitHub.

Appendix: source

Thrown at crates/core/src/host/module_host.rs:2104

    pub(in crate::host) fn record_view_command_round_trip(info: &ModuleInfo, metric: ViewCommandMetric) {
        match metric.workload {
            WorkloadType::Subscribe => info
                .metrics
                .request_round_trip_subscribe
                .observe(metric.timer.elapsed().as_secs_f64()),
            WorkloadType::Unsubscribe => info
                .metrics
                .request_round_trip_unsubscribe
                .observe(metric.timer.elapsed().as_secs_f64()),
            _ => {}
        }
    }

    async fn call_sql_command(&self, cmd: SqlCommand) -> Result<SqlCommandResult, DBError> {
        call_instance!(self, "call_sql", cmd, |cmd, inst| inst.call_sql(cmd), |cmd, inst| inst
            .call_sql(cmd)
            .await,)
        .map_err(|_| DBError::Other(anyhow::anyhow!("no such module")))
    }

    pub async fn disconnect_client(&self, client_id: ClientActorId) {
        log::trace!("disconnecting client {client_id}");
        if let Err(e) = call_instance!(
            self,
            "disconnect_client",
            client_id,
            |client_id, inst| inst.disconnect_client(client_id),
            |client_id, inst| inst.disconnect_client(client_id).await,
        ) {
            log::error!("Error from client_disconnected transaction: {e}");
        }
    }

    pub fn disconnect_client_inner(
        client_id: ClientActorId,
        info: &ModuleInfo,

View on GitHub (pinned to eddf9f5014)