{"record":{"id":"c13c614d7a3a9e7e","repo":"clockworklabs/SpacetimeDB","slug":"failed-to-get-table-with-name-table-name","errorCode":null,"errorMessage":"Failed to get table with name: {table_name}","messagePattern":"Failed to get table with name: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bindings/src/lib.rs","lineNumber":1995,"sourceCode":"/// The read-only version of [`Local`]\n#[non_exhaustive]\npub struct LocalReadOnly {}\n\n// #[cfg(target_arch = \"wasm32\")]\n// #[global_allocator]\n// static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;\n\n// This should guarantee in most cases that we don't have to reallocate an iterator\n// buffer, unless there's a single row that serializes to >1 MiB.\nconst DEFAULT_BUFFER_CAPACITY: usize = spacetimedb_primitives::ROW_ITER_CHUNK_SIZE * 2;\n\n/// Queries and returns the `table_id` associated with the given (table) `name`.\n///\n/// Panics if the table does not exist.\n#[doc(hidden)]\npub fn table_id_from_name(table_name: &str) -> TableId {\n    sys::table_id_from_name(table_name).unwrap_or_else(|_| {\n        panic!(\"Failed to get table with name: {table_name}\");\n    })\n}\n\nthread_local! {\n    /// A global pool of buffers used for iteration.\n    // This gets optimized away to a normal global since wasm32 doesn't have threads by default.\n    static ITER_BUFS: RefCell<Vec<Vec<u8>>> = const { RefCell::new(Vec::new()) };\n}\n\nstruct IterBuf {\n    buf: Vec<u8>,\n}\n\nimpl IterBuf {\n    /// Take a buffer from the pool of buffers for row iterators, if one exists. Otherwise, allocate a new one.\n    fn take() -> Self {\n        let buf = ITER_BUFS\n            .with_borrow_mut(|v| v.pop())","sourceCodeStart":1977,"sourceCodeEnd":2013,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/bindings/src/lib.rs#L1977-L2013","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Regenerate bindings: spacetetime generate (or spacetime generate --lang rust) against the currently deployed module.","Inspect the deployed schema (spacetime db info / describe the module) and confirm the exact table name, including casing.","Republish the module if the table should exist: spacetime publish, then regenerate bindings."],"exampleFix":"# before: bindings reference a table that no longer exists\nspacetime publish my-module   # module now uses `users` table\n# client code still calls ctx.db.player()... -> panics: Failed to get table with name: player\n\n# after: regenerate bindings after every schema change\nspacetime publish my-module && spacetime generate --lang rust","handlingStrategy":"validation","validationCode":"use spacetimedb::sys;\nmatch sys::table_id_from_name(\"player\") {\n    Ok(_id) => { /* safe to use the table handle */ }\n    Err(_) => { /* table absent: regenerate bindings / republish module */ }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Regenerate bindings after every publish that changes table names or shapes.","Verify exact table names (case-sensitive) against the deployed schema with spacetime db info.","Automate publish + generate in one CI step so bindings never drift from the module."],"tags":["rust","module","table","schema-mismatch","bindings"],"backgroundTag":"table-not-found","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}