{"record":{"id":"c2f0a436d88fa920","repo":"clockworklabs/SpacetimeDB","slug":"v2-subscriptions-without-a-module-host-are-not-sup","errorCode":null,"errorMessage":"v2 subscriptions without a module host are not supported yet","messagePattern":"v2 subscriptions without a module host are not supported yet","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/core/src/subscription/module_subscription_actor.rs","lineNumber":1269,"sourceCode":"        )\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_v2_subscription(\n        &self,\n        host: Option<&ModuleHost>,\n        sender: Arc<ClientConnectionSender>,\n        auth: AuthCtx,\n        request: ws_v2::Subscribe,\n        timer: Instant,\n        _assert: Option<AssertTxFn>,\n    ) -> Result<Option<ExecutionMetrics>, DBError> {\n        match host {\n            Some(host) => host.call_view_add_v2_subscription(sender, auth, request, timer).await,\n            None => panic!(\"v2 subscriptions without a module host are not supported yet\"),\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) => {\n                host.call_view_add_multi_subscription(sender, auth, request, timer)","sourceCodeStart":1251,"sourceCodeEnd":1287,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/9e0d92412ff2248f401a8ad12d535f2b5ac30912/crates/core/src/subscription/module_subscription_actor.rs#L1251-L1287","documentation":"The subscription actor's add_v2_subscription takes `host: Option<&ModuleHost>` and delegates ws_v2 Subscribe messages to the module host, because v2 subscriptions execute module view code. When the actor holds no ModuleHost for the database, the None arm panics ('not supported yet'). The panic happens server-side while processing a client subscribe, instead of returning a DBError to the client, so the actor task crashes.","triggerScenarios":"A client sends a ws_v2 Subscribe for a database whose ModuleHost is absent: database created but no module published yet, host still initializing after publish, or the host not yet spawned when the subscribe arrives.","commonSituations":"Clients subscribing immediately after server start or publish before the module host is live; empty databases that never had a module; client libraries defaulting to the v2 subscription protocol against a database in that state.","solutions":["Publish a module for the database and confirm the host is running (`spacetime logs`, server status) before clients subscribe.","Retry the subscription client-side with backoff until the module host is available.","Ensure the client SDK's subscription protocol version is supported by the server/database state.","Upgrade spacetimedb: newer builds convert this into a structured client error instead of a panic."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// client: only issue v2 subscribes once the module host is live\n// (adapt the status check to your SDK's database info API)\nconst status = await server.getDatabaseStatus(dbId);\nif (status?.moduleHostState !== 'running') {\n  throw new Error(`module host not running (${status?.moduleHostState}); publish before subscribing`);\n}\nawait client.subscription.subscribe(dbId, queries); // v2 path","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Publish the module and wait for it to become healthy before clients subscribe.","Gate v2 subscription usage on a confirmed module deployment.","Add reconnect-with-backoff so clients that race a module update resubscribe once the host is back.","Avoid subscribing to databases that intentionally have no module."],"tags":["spacetimedb","subscription","websocket","module-host","panic"],"backgroundTag":"missing-module-host","analyzedSha":"9e0d92412ff2248f401a8ad12d535f2b5ac30912","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}