clockworklabs/SpacetimeDB · error · anyhow::Error

Views evaluation did not complete successfully during…

Error message

Views evaluation did not complete successfully during database update: {:?}

What it means

The same update-time view evaluation, but the failure is a non-Success ViewOutcome without a trap - the {:?} in the message names the exact outcome (e.g. budget exhausted or an error outcome). As with a trap, the transaction is rolled back and the update aborts with ErrorExecutingMigration, leaving the previous program intact.

Solutions

  1. Read the outcome debug embedded in the message to identify the exact non-success reason (budget vs error).
  2. Raise the evaluation budget for the update or split the migration into smaller batches.
  3. Simplify or defer heavy views until after the update completes.
  4. Fix view error paths that fire on pre-migration rows.
Defensive patterns

Strategy: try-catch

Try / catch

Match UpdateDatabaseResult::ErrorExecutingMigration and parse the embedded ViewOutcome debug to distinguish budget exhaustion from view errors before choosing a fix.

Prevention

When it happens

Trigger: Views over large tables exceed the evaluation energy budget during an update; a view returns an error outcome on legacy rows; budget accounting changes between host versions.

Common situations: Big datasets where view refresh during migration outgrows the default budget; view error paths triggered only by old-shaped data.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@9e0d92412f (2026-08-20). Data as JSON: /api/errors/82a862abb281c830. Report an issue: GitHub.

Appendix: source

Thrown at crates/core/src/host/wasm_common/module_host_actor.rs:742

                            tx_offset,
                            durable_offset,
                        }
                    }
                    crate::db::update::UpdateResult::EvaluateSubscribedViews => {
                        let (out, _, trapped) = self.evaluate_subscribed_views(tx, inst)?;
                        tx = out.tx;
                        if trapped || out.outcome != ViewOutcome::Success {
                            let msg = match trapped {
                                true => "Trapped while evaluating views during database update".to_string(),
                                false => format!(
                                    "Views evaluation did not complete successfully during database update: {:?}",
                                    out.outcome
                                ),
                            };

                            let (_, tx_metrics, reducer) = stdb.rollback_mut_tx(tx);
                            stdb.report_mut_tx_metrics(reducer, tx_metrics, None);
                            UpdateDatabaseResult::ErrorExecutingMigration(anyhow::anyhow!(msg))
                        } else {
                            let tx_offset =
                                succeed(self.info.clone(), out.execution_budget_used, out.total_duration, tx);
                            UpdateDatabaseResult::UpdatePerformed {
                                tx_offset,
                                durable_offset,
                            }
                        }
                    }
                    crate::db::update::UpdateResult::RequiresClientDisconnect => {
                        let tx_offset = succeed(self.info.clone(), FunctionBudget::ZERO, Duration::ZERO, tx);
                        UpdateDatabaseResult::UpdatePerformedWithClientDisconnect {
                            tx_offset,
                            durable_offset,
                        }
                    }
                };

View on GitHub (pinned to 9e0d92412f)