{"record":{"id":"0819ab38faf579ee","repo":"clockworklabs/SpacetimeDB","slug":"view-not-found-in-database","errorCode":null,"errorMessage":"view {} not found in database","messagePattern":"view (.+?) not found in database","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/core/src/host/wasm_common/module_host_actor.rs","lineNumber":1534,"sourceCode":"    for (prefix, owning_def, view) in module_def.all_views_with_prefix() {\n        let ViewDef {\n            name: local_name,\n            is_anonymous,\n            product_type_ref,\n            ..\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,","sourceCodeStart":1516,"sourceCodeEnd":1552,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/core/src/host/wasm_common/module_host_actor.rs#L1516-L1552","documentation":"Mirror image of the module_def lookup: the module defines the view and the global function pointer was found, but tx.view_from_name cannot find a matching st_view row in the database. The module code and the database's view catalog are out of sync — the module expects a registered view the database never created or no longer has.","triggerScenarios":"View registration rows were never created for this database (a publish interrupted before view registration committed) or were removed; publishing a module whose view set differs from the database catalog without going through the normal update path; databases restored or modified out-of-band.","commonSituations":"Interrupted or partially failed publishes; database backups restored mid-update; direct manipulation of system tables.","solutions":["Re-run the publish so the update path recreates view registrations consistent with module_def.","If the catalog is stuck inconsistent, recreate the database (when data is disposable) or repair the st_view rows.","Verify the canonical view name matches exactly, including prefixes, between module and database.","Let publishes commit or roll back fully; avoid killing them midway."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify the database catalog contains every view the module defines\nfor name in module_def.view_names() {\n    anyhow::ensure!(tx.view_from_name(name)?.is_some(), \"view {name} missing from database\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Let publishes commit or roll back fully; never kill them midway.","After an interrupted publish, republish to reconcile the view catalog.","Avoid out-of-band restores or edits of system tables."],"tags":["views","view-registration","database-state","publish"],"backgroundTag":"view-not-found","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}