{"record":{"id":"5932a1039d259ed6","repo":"clockworklabs/SpacetimeDB","slug":"view-does-not-have-a-backing-table-in-database","errorCode":null,"errorMessage":"view {} does not have a backing table in database","messagePattern":"view (.+?) does not have a backing table in database","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/core/src/host/wasm_common/module_host_actor.rs","lineNumber":1539,"sourceCode":"            ..\n        } = view;\n\n        // Full namespaced canonical name: matches both the st_view registration\n        // (create_view / create_view_with_prefix) and `view_by_name_with_global_fn_ptr`.\n        let view_name = prefix.join(local_name.clone());\n\n        let (global_fn_ptr, _, _) = module_def\n            .view_by_name_with_global_fn_ptr(&view_name)\n            .ok_or_else(|| anyhow::anyhow!(\"view {} not found in module_def\", view_name))?;\n\n        let st_view = tx\n            .view_from_name(&view_name)?\n            .ok_or_else(|| anyhow::anyhow!(\"view {} not found in database\", view_name))?;\n\n        let view_id = st_view.view_id;\n        let table_id = st_view\n            .table_id\n            .ok_or_else(|| anyhow::anyhow!(\"view {} does not have a backing table in database\", view_name))?;\n        let subs = tx.materialized_view_instances_for_view(view_id);\n        let view_typespace = Arc::new(owning_def.typespace().clone());\n\n        if *is_anonymous {\n            if subs.is_empty() {\n                continue;\n            }\n            view_calls.push(CallViewParams {\n                view_name: view_name.clone(),\n                view_id,\n                table_id,\n                fn_ptr: global_fn_ptr,\n                caller: owner_identity,\n                sender: None,\n                args: ArgsTuple::nullary(),\n                row_type: *product_type_ref,\n                timestamp: Timestamp::now(),\n                view_typespace: view_typespace.clone(),","sourceCodeStart":1521,"sourceCodeEnd":1557,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/core/src/host/wasm_common/module_host_actor.rs#L1521-L1557","documentation":"The view is defined in the module and registered in the database (the st_view row was found), but that row has no table_id — the backing table where materialized rows live was never created for this view. Evaluation cannot proceed because there is nowhere to materialize results, so view initialization aborts.","triggerScenarios":"A view registration persisted without creating its backing table: an interrupted or older publish that registered the view but not the table, host versions that did not create backing tables, or catalog corruption after failed updates.","commonSituations":"Upgrades across host versions that changed how backing tables are created; crashed publishes leaving half-registered views; manual edits to the view catalog.","solutions":["Republish the module so the update path (re)creates the backing table for the view.","If the registration is stale, drop the broken view registration and republish to re-register cleanly.","Recreate the database if the state is disposable.","Check host logs from the original publish for why table creation was skipped or failed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify each registered view has a backing table before relying on materialized state\nfor name in module_def.view_names() {\n    let v = tx.view_from_name(name)?.context(\"view missing\")?;\n    anyhow::ensure!(v.table_id.is_some(), \"view {name} has no backing table\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Republish to recreate view registrations after host version upgrades.","Watch publish logs for view/table creation failures.","Recreate the database if the view catalog is half-registered and the data is disposable."],"tags":["views","materialized-views","view-registration","database-state"],"backgroundTag":"view-not-found","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}