clockworklabs/SpacetimeDB · error

batch subscriptions without a module host are not supported…

Error message

batch subscriptions without a module host are not supported yet

What it means

The module subscription actor's add_batch_subscription path requires a module host handle; when host is None the actor panics because batch subscriptions cannot be evaluated without module code. This is an unsupported-operation guard: the feature (batch subscriptions) is only implemented for hosted modules.

Solutions

  1. Ensure the module is published and its host is running before sending batch subscriptions.
  2. Fall back to single (non-batch) subscriptions via add_single_subscription when no module host exists.
  3. Retry the subscription after the host becomes available (await module startup/ready signal).
  4. Check server logs for why the host is missing (failed module init, unpublished database).

Example fix

// before
client.subscriptionBuilder().subscribeAll(queries).submit();
// after
if queries.len() > 1 && !moduleHostReady(db) {
    for q in queries { subscribeSingle(q); }
} else {
    client.subscriptionBuilder().subscribeAll(queries).submit();
}
Defensive patterns

Strategy: fallback

Try / catch

// client: catch subscribe error and fall back to single-query subscriptions

Prevention

When it happens

Trigger: Issuing a batch subscription request against a database instance whose module host is None (e.g. no module published, host not yet spawned, or a non-module database).

Common situations: Client subscribes with multiple queries (batch API) immediately after publish before the host is ready, or against a database deleted/without an owner module.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at crates/core/src/subscription/module_subscription_actor.rs:1403

    ///
    /// A set which fails to compile or evaluate reports a per-set error in the
    /// response while the remaining sets still apply.
    #[tracing::instrument(level = "trace", skip_all)]
    pub async fn add_batch_subscription(
        &self,
        host: Option<&ModuleHost>,
        sender: Arc<ClientConnectionSender>,
        auth: AuthCtx,
        request: ws_v2::SubscribeBatch,
        timer: Instant,
        _assert: Option<AssertTxFn>,
    ) -> Result<Option<ExecutionMetrics>, DBError> {
        match host {
            Some(host) => {
                host.call_view_add_batch_subscription(sender, auth, request, timer)
                    .await
            }
            None => panic!("batch subscriptions without a module host are not supported yet"),
        }
    }

    /// Add a subscription consisting of multiple queries.
    ///
    /// Read more in [`Self::add_single_subscription`].
    #[tracing::instrument(level = "trace", skip_all)]
    pub async fn add_multi_subscription(
        &self,
        host: Option<&ModuleHost>,
        sender: Arc<ClientConnectionSender>,
        auth: AuthCtx,
        request: ws_v1::SubscribeMulti,
        timer: Instant,
        _assert: Option<AssertTxFn>,
    ) -> Result<Option<ExecutionMetrics>, DBError> {
        match host {
            Some(host) => {

View on GitHub (pinned to eddf9f5014)