clockworklabs/SpacetimeDB · error

unexpected error from `datastore_delete_by_index_scan_point_

Error message

unexpected error from `datastore_delete_by_index_scan_point_bsatn`: {e}

What it means

IndexColumn::delete deletes all rows matching a point on an index and panics when the datastore_delete_by_index_scan_point_bsatn syscall errors. The count of deleted rows is the normal return; an Err errno means the serialized point does not decode as the index key type or the index id is stale - a schema/metadata mismatch rather than a data problem.

Source

Thrown at crates/bindings/src/table.rs:647

    ///     // Delete users with exactly 25 dogs, and exactly the name "Joseph".
    ///     by_dogs_and_name.delete((25u64, "Joseph"));
    ///
    ///     // You can also pass arguments by reference if desired.
    ///     by_dogs_and_name.delete((&25u64, &"Joseph".to_string()));
    /// }
    /// # }
    /// ```
    ///
    /// May panic if deleting any one of the rows would violate a constraint,
    /// though at present no such constraints exist.
    pub fn delete<P, K>(&self, point: P) -> u64
    where
        P: WithPointArg<K>,
    {
        let index_id = Idx::index_id();
        point.with_point_arg(|point| {
            sys::datastore_delete_by_index_scan_point_bsatn(index_id, point)
                .unwrap_or_else(|e| panic!("unexpected error from `datastore_delete_by_index_scan_point_bsatn`: {e}"))
                .into()
        })
    }
}

/// Scans `Tbl` for `point` using the index `Idx`.
///
/// The type parameter `K` is either `()` or [`SingleBound`]
/// and is used to workaround the orphan rule.
fn filter_point<Tbl, Idx, K>(point: impl WithPointArg<K>) -> impl Iterator<Item = Tbl::Row>
where
    Tbl: Table,
    Idx: IndexIsPointed,
{
    let index_id = Idx::index_id();
    let iter = point.with_point_arg(|point| datastore_index_scan_point_bsatn(index_id, point));
    TableIter::new(iter)
}

View on GitHub (pinned to 6dee26c6ef)

Solutions

  1. Regenerate bindings and do a clean republish so the compiled index id matches the deployed schema.
  2. Verify the column actually carries #[index] or #[unique] in the current module source.
  3. Match crate and host versions; file an issue with the errno value if reproducible.
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Deleting via an index column (ctx.db.table().col().delete(v)) where the column's type changed since the module was built; generated index ids pointing at a different index after partial redeploys.

Common situations: Module refactored (column renamed/retyped) while old generated table code is still compiled in; mixed versions of the spacetimedb crate and server.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20). Data as JSON: /api/errors/0688b168eb186f4b. Report an issue: GitHub.