{"record":{"id":"04ca8c80d9194545","repo":"clockworklabs/SpacetimeDB","slug":"found-is-anonymous-in-st-view-but-in-module","errorCode":null,"errorMessage":"found is_anonymous={} in st_view, but {} in module when updating view `{}`","messagePattern":"found is_anonymous=(.+?) in st_view, but (.+?) in module when updating view `(.+?)`","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/core/src/host/module_host.rs","lineNumber":1230,"sourceCode":"    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\", view_id))?;\n\n    let (global_fn_ptr, view_def, owning_def) = module_def\n        .view_by_name_with_global_fn_ptr(&st_view.view_name.clone().into())\n        .ok_or_else(|| {\n            anyhow::anyhow!(\n                \"view `{}` for view id `{}` not found in current module\",\n                st_view.view_name,\n                view_id\n            )\n        })?;\n\n    let is_anonymous = view_def.is_anonymous;\n\n    if st_view.is_anonymous != is_anonymous {\n        return Err(anyhow::anyhow!(\n            \"found is_anonymous={} in st_view, but {} in module when updating view `{}`\",\n            st_view.is_anonymous,\n            is_anonymous,\n            st_view.view_name,\n        ));\n    }\n\n    Ok(ResolvedViewForRefresh {\n        view_id,\n        table_id,\n        view_def,\n        view_name: st_view.view_name.into(),\n        global_fn_ptr,\n        owning_def,\n    })\n}\n\npub struct CallProcedureParams {","sourceCodeStart":1212,"sourceCodeEnd":1248,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/core/src/host/module_host.rs#L1212-L1248","documentation":"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.","triggerScenarios":"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.","commonSituations":"Editing a view's anonymous attribute between publishes; hand-crafted schema diffs; version skew between host metadata format and module definition.","solutions":["Republish the module to regenerate st_views rows from the current definition.","Instead of flipping anonymity on an existing view, create a new view with the desired anonymity and drop the old one.","If the module is unchanged, treat the mismatch as metadata corruption: restore or recreate the database.","Report host bugs with a minimal reproducing module."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Catch the mismatch during refresh/update and route to a republish workflow; include both flag values (already in the message) in the incident report.","preventionTips":["Never change a view's anonymity in place; replace the view.","Keep module schema diffs reviewable before publish.","Test publishes on a staging copy of production data."],"tags":["view","anonymous","metadata","module-update"],"backgroundTag":"schema-metadata-inconsistent","analyzedSha":"eddf9f5014579a50d4b67630e28b6e15cad9c4af","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}