clockworklabs/SpacetimeDB · error · anyhow::Error

found is_anonymous= in st_view, but in module when updating…

Error message

found is_anonymous={} in st_view, but {} in module when updating view `{}`

What it means

Each view carries an is_anonymous flag in both the st_views metadata and the module definition. resolve_view_for_refresh compares the two and errors on any mismatch, because anonymity changes how the view's results are exposed; the stored row and the loaded module must agree exactly.

Solutions

  1. Republish the module to regenerate st_views rows from the current definition.
  2. Instead of flipping anonymity on an existing view, create a new view with the desired anonymity and drop the old one.
  3. If the module is unchanged, treat the mismatch as metadata corruption: restore or recreate the database.
  4. Report host bugs with a minimal reproducing module.
Defensive patterns

Strategy: try-catch

Try / catch

Catch the mismatch during refresh/update and route to a republish workflow; include both flag values (already in the message) in the incident report.

Prevention

When it happens

Trigger: A module update toggles a view's anonymous attribute (adding or removing it in the DSL) without the corresponding metadata migration; a partial update leaves mixed state between st_views and the new module.

Common situations: Editing a view's anonymous attribute between publishes; hand-crafted schema diffs; version skew between host metadata format and module definition.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@eddf9f5014 (2026-08-20). Data as JSON: /api/errors/04ca8c80d9194545. Report an issue: GitHub.

Appendix: source

Thrown at crates/core/src/host/module_host.rs:1230

    let view_id = st_view.view_id;
    let table_id = st_view
        .table_id
        .ok_or_else(|| anyhow::anyhow!("view {:?} does not have a backing table", view_id))?;

    let (global_fn_ptr, view_def, owning_def) = module_def
        .view_by_name_with_global_fn_ptr(&st_view.view_name.clone().into())
        .ok_or_else(|| {
            anyhow::anyhow!(
                "view `{}` for view id `{}` not found in current module",
                st_view.view_name,
                view_id
            )
        })?;

    let is_anonymous = view_def.is_anonymous;

    if st_view.is_anonymous != is_anonymous {
        return Err(anyhow::anyhow!(
            "found is_anonymous={} in st_view, but {} in module when updating view `{}`",
            st_view.is_anonymous,
            is_anonymous,
            st_view.view_name,
        ));
    }

    Ok(ResolvedViewForRefresh {
        view_id,
        table_id,
        view_def,
        view_name: st_view.view_name.into(),
        global_fn_ptr,
        owning_def,
    })
}

pub struct CallProcedureParams {

View on GitHub (pinned to eddf9f5014)