clockworklabs/SpacetimeDB · error · DBError::Other

Subscription not found: {subscription_id:?}

Error message

Subscription not found: {subscription_id:?}

What it means

Error "Subscription not found: {subscription_id:?}" thrown in clockworklabs/SpacetimeDB.

Source

Thrown at crates/core/src/subscription/module_subscription_manager.rs:854

    }

    /// Remove a single subscription for a client.
    /// This will return an error if the client does not have a subscription with the given query id.
    pub fn remove_subscription(&mut self, client_id: ClientId, query_id: ClientQueryId) -> Result<Vec<Query>, DBError> {
        let subscription_id = (client_id, query_id);
        let Some(ci) = self
            .clients
            .get_mut(&client_id)
            .filter(|ci| !ci.dropped.load(Ordering::Acquire))
        else {
            return Err(anyhow::anyhow!("Client not found: {client_id:?}").into());
        };

        #[cfg(test)]
        ci.assert_ref_count_consistency();

        let Some(query_hashes) = ci.v1_subscriptions.remove(&subscription_id) else {
            return Err(anyhow::anyhow!("Subscription not found: {subscription_id:?}").into());
        };
        let mut queries_to_return = Vec::new();
        for hash in query_hashes {
            let remaining_refs = {
                let Some(count) = ci.subscription_ref_count.get_mut(&hash) else {
                    return Err(anyhow::anyhow!("Query count not found for query hash: {hash:?}").into());
                };
                *count -= 1;
                *count
            };
            if remaining_refs > 0 {
                // The client is still subscribed to this query, so we are done for now.
                continue;
            }
            // The client is no longer subscribed to this query.
            ci.subscription_ref_count.remove(&hash);
            let Some(query_state) = self.queries.get_mut(&hash) else {
                return Err(anyhow::anyhow!("Query state not found for query hash: {hash:?}").into());

View on GitHub (pinned to 524b4487d9)

When it happens

Trigger: Thrown at crates/core/src/subscription/module_subscription_manager.rs:854 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/7d910608ed4f1cb7. Report an issue: GitHub.