clockworklabs/SpacetimeDB · error

Failed to get table with name: {table_name}

Error message

Failed to get table with name: {table_name}

What it means

Generated Rust table handles resolve their TableId by table name through a host syscall at first use; this panic means the deployed module has no table with that name. It is a name-lookup failure, not a permissions or data error - the table simply is not in the published module's schema.

Source

Thrown at crates/bindings/src/lib.rs:1995

/// The read-only version of [`Local`]
#[non_exhaustive]
pub struct LocalReadOnly {}

// #[cfg(target_arch = "wasm32")]
// #[global_allocator]
// static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

// This should guarantee in most cases that we don't have to reallocate an iterator
// buffer, unless there's a single row that serializes to >1 MiB.
const DEFAULT_BUFFER_CAPACITY: usize = spacetimedb_primitives::ROW_ITER_CHUNK_SIZE * 2;

/// Queries and returns the `table_id` associated with the given (table) `name`.
///
/// Panics if the table does not exist.
#[doc(hidden)]
pub fn table_id_from_name(table_name: &str) -> TableId {
    sys::table_id_from_name(table_name).unwrap_or_else(|_| {
        panic!("Failed to get table with name: {table_name}");
    })
}

thread_local! {
    /// A global pool of buffers used for iteration.
    // This gets optimized away to a normal global since wasm32 doesn't have threads by default.
    static ITER_BUFS: RefCell<Vec<Vec<u8>>> = const { RefCell::new(Vec::new()) };
}

struct IterBuf {
    buf: Vec<u8>,
}

impl IterBuf {
    /// Take a buffer from the pool of buffers for row iterators, if one exists. Otherwise, allocate a new one.
    fn take() -> Self {
        let buf = ITER_BUFS
            .with_borrow_mut(|v| v.pop())

View on GitHub (pinned to 6dee26c6ef)

Solutions

  1. Regenerate bindings: spacetetime generate (or spacetime generate --lang rust) against the currently deployed module.
  2. Inspect the deployed schema (spacetime db info / describe the module) and confirm the exact table name, including casing.
  3. Republish the module if the table should exist: spacetime publish, then regenerate bindings.

Example fix

# before: bindings reference a table that no longer exists
spacetime publish my-module   # module now uses `users` table
# client code still calls ctx.db.player()... -> panics: Failed to get table with name: player

# after: regenerate bindings after every schema change
spacetime publish my-module && spacetime generate --lang rust
Defensive patterns

Strategy: validation

Validate before calling

use spacetimedb::sys;
match sys::table_id_from_name("player") {
    Ok(_id) => { /* safe to use the table handle */ }
    Err(_) => { /* table absent: regenerate bindings / republish module */ }
}

Prevention

When it happens

Trigger: Bindings generated against an older/newer module version where the table was renamed or dropped; publishing the module from different source than the bindings were generated from; a hand-written table name string with a typo or wrong casing.

Common situations: Redeployed the module with schema changes but forgot `spacetime generate`; publishing to a different database than the one the client/module targets; renames during refactoring (player -> users) without regenerating.

Related errors


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