{"record":{"id":"9db8347b89f947a2","repo":"clockworklabs/SpacetimeDB","slug":"batch-subscriptions-without-a-module-host-are-not-supported","errorCode":null,"errorMessage":"batch subscriptions without a module host are not supported yet","messagePattern":"batch subscriptions without a module host are not supported yet","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/core/src/subscription/module_subscription_actor.rs","lineNumber":1403,"sourceCode":"    ///\n    /// A set which fails to compile or evaluate reports a per-set error in the\n    /// response while the remaining sets still apply.\n    #[tracing::instrument(level = \"trace\", skip_all)]\n    pub async fn add_batch_subscription(\n        &self,\n        host: Option<&ModuleHost>,\n        sender: Arc<ClientConnectionSender>,\n        auth: AuthCtx,\n        request: ws_v2::SubscribeBatch,\n        timer: Instant,\n        _assert: Option<AssertTxFn>,\n    ) -> Result<Option<ExecutionMetrics>, DBError> {\n        match host {\n            Some(host) => {\n                host.call_view_add_batch_subscription(sender, auth, request, timer)\n                    .await\n            }\n            None => panic!(\"batch subscriptions without a module host are not supported yet\"),\n        }\n    }\n\n    /// Add a subscription consisting of multiple queries.\n    ///\n    /// Read more in [`Self::add_single_subscription`].\n    #[tracing::instrument(level = \"trace\", skip_all)]\n    pub async fn add_multi_subscription(\n        &self,\n        host: Option<&ModuleHost>,\n        sender: Arc<ClientConnectionSender>,\n        auth: AuthCtx,\n        request: ws_v1::SubscribeMulti,\n        timer: Instant,\n        _assert: Option<AssertTxFn>,\n    ) -> Result<Option<ExecutionMetrics>, DBError> {\n        match host {\n            Some(host) => {","sourceCodeStart":1385,"sourceCodeEnd":1421,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/core/src/subscription/module_subscription_actor.rs#L1385-L1421","documentation":"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.","triggerScenarios":"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).","commonSituations":"Client subscribes with multiple queries (batch API) immediately after publish before the host is ready, or against a database deleted/without an owner module.","solutions":["Ensure the module is published and its host is running before sending batch subscriptions.","Fall back to single (non-batch) subscriptions via add_single_subscription when no module host exists.","Retry the subscription after the host becomes available (await module startup/ready signal).","Check server logs for why the host is missing (failed module init, unpublished database)."],"exampleFix":"// before\nclient.subscriptionBuilder().subscribeAll(queries).submit();\n// after\nif queries.len() > 1 && !moduleHostReady(db) {\n    for q in queries { subscribeSingle(q); }\n} else {\n    client.subscriptionBuilder().subscribeAll(queries).submit();\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"// client: catch subscribe error and fall back to single-query subscriptions","preventionTips":["Only use batch subscriptions against databases with a running module host","Wait for module-ready signal before subscribing","Implement per-query fallback in client SDK wrappers"],"tags":["subscriptions","unsupported-operation","panic","rust"],"backgroundTag":"unsupported-operation","analyzedSha":"eddf9f5014579a50d4b67630e28b6e15cad9c4af","analyzedAt":"2026-09-20T12:15:59.611Z","contentChangedAt":"2026-09-20T12:15:59.611Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}