{"record":{"id":"82a862abb281c830","repo":"clockworklabs/SpacetimeDB","slug":"views-evaluation-did-not-complete-successfully-dur","errorCode":null,"errorMessage":"Views evaluation did not complete successfully during database update: {:?}","messagePattern":"Views evaluation did not complete successfully during database update: (.+?)","errorType":"exception","errorClass":"UpdateDatabaseResult::ErrorExecutingMigration","httpStatus":null,"severity":"error","filePath":"crates/core/src/host/wasm_common/module_host_actor.rs","lineNumber":734,"sourceCode":"                };\n                let durable_offset = stdb.durable_tx_offset();\n\n                let res: UpdateDatabaseResult = match res {\n                    crate::db::update::UpdateResult::Success => {\n                        let tx_offset = succeed(self.info.clone(), FunctionBudget::ZERO, Duration::ZERO, tx);\n                        UpdateDatabaseResult::UpdatePerformed {\n                            tx_offset,\n                            durable_offset,\n                        }\n                    }\n                    crate::db::update::UpdateResult::EvaluateSubscribedViews => {\n                        let (out, _, trapped) = self.evaluate_subscribed_views(tx, inst)?;\n                        tx = out.tx;\n                        if trapped || out.outcome != ViewOutcome::Success {\n                            let msg = match trapped {\n                                true => \"Trapped while evaluating views during database update\".to_string(),\n                                false => format!(\n                                    \"Views evaluation did not complete successfully during database update: {:?}\",\n                                    out.outcome\n                                ),\n                            };\n\n                            let (_, tx_metrics, reducer) = stdb.rollback_mut_tx(tx);\n                            stdb.report_mut_tx_metrics(reducer, tx_metrics, None);\n                            UpdateDatabaseResult::ErrorExecutingMigration(anyhow::anyhow!(msg))\n                        } else {\n                            let tx_offset =\n                                succeed(self.info.clone(), out.execution_budget_used, out.total_duration, tx);\n                            UpdateDatabaseResult::UpdatePerformed {\n                                tx_offset,\n                                durable_offset,\n                            }\n                        }\n                    }\n                    crate::db::update::UpdateResult::RequiresClientDisconnect => {\n                        let tx_offset = succeed(self.info.clone(), FunctionBudget::ZERO, Duration::ZERO, tx);","sourceCodeStart":716,"sourceCodeEnd":752,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/core/src/host/wasm_common/module_host_actor.rs#L716-L752","documentation":"Companion to the trap case: after evaluating subscribed views during a database update, the host checks the outcome; anything other than ViewOutcome::Success that did not trap is formatted into this message with the outcome's debug value. The transaction is rolled back and the publish fails as ErrorExecutingMigration, so the database remains on its previous schema and data.","triggerScenarios":"View evaluation during a publish ends abnormally without a trap: execution budget or time limits exhausted by expensive views over large tables, or an internal non-success outcome reported by the view runner (embedded in the message as the {:?} value).","commonSituations":"Materialized views scanning very large tables during migration on a loaded host; unbounded view computations; execution budget defaults too small for the dataset size.","solutions":["Read the embedded outcome value — budget exhaustion points at expensive views; other outcomes point at the runner's specific reason.","Optimize or narrow the views (filters, limits, incremental logic) so evaluation completes within budget.","Raise the execution budget for the update if the deployment allows it.","Re-run the publish once the views fit the budget; the failed attempt rolled back cleanly."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Size-check views before an update: evaluate them against a production-sized copy\n// and confirm they finish within the configured execution budget.\nlet elapsed = time_evaluate_all_views(snapshot_db.clone())?;\nanyhow::ensure!(elapsed < view_budget(), \"views exceed budget: {elapsed:?}\");","typeGuard":null,"tryCatchPattern":"match update_result {\n    UpdateDatabaseResult::ErrorExecutingMigration(e)\n        if e.to_string().contains(\"did not complete successfully\") =>\n    {\n        // read the embedded outcome; narrow the views or raise the budget, then republish\n        log::warn!(\"update rejected: {e:#}\");\n    }\n    other => { /* ... */ }\n}","preventionTips":["Keep view computations bounded (filters, limits) over large tables.","Measure view evaluation time on production-sized data before updates.","Watch the embedded outcome value — budget exhaustion is the usual cause."],"tags":["views","migration","budget-exhausted","database-update"],"backgroundTag":"view-evaluation-failed","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}