{"record":{"id":"80b4931d5a4894ed","repo":"clockworklabs/SpacetimeDB","slug":"view-for-view-id-not-found-in-current-mo","errorCode":null,"errorMessage":"view `{}` for view id `{}` not found in current module","messagePattern":"view `(.+?)` for view id `(.+?)` not found in current module","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/core/src/host/module_host.rs","lineNumber":1220,"sourceCode":"/// its readset, `st_view`, and the [`ModuleDef`].\npub(crate) fn resolve_view_for_refresh<'a>(\n    tx: &MutTxId,\n    module_def: &'a ModuleDef,\n    view_call: &ViewCallInfo,\n) -> anyhow::Result<ResolvedViewForRefresh<'a>> {\n    let st_view = tx\n        .lookup_st_view(view_call.view_id)\n        .with_context(|| format!(\"failed to look up view {}\", view_call.view_id))?;\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\", 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 {","sourceCodeStart":1202,"sourceCodeEnd":1238,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/core/src/host/module_host.rs#L1202-L1238","documentation":"The st_views row for a view id stores the view name, and the host resolves that name against the currently loaded ModuleDef via view_by_name_with_global_fn_ptr. A miss means stored metadata and the running module disagree - usually because the module changed (renamed/removed views) while stale st_views rows remain.","triggerScenarios":"A module update renamed or deleted a view while a refresh was already scheduled for the old view id; a concurrent publish racing a view call; submodule layout changed so the name no longer resolves.","commonSituations":"Deploying a schema refactor across versions; a crashed update leaving half-old metadata; clients holding view ids from an older program.","solutions":["Republish or fully re-run the module update so metadata matches the program.","Avoid renaming/removing views in place: add the new view, migrate, then remove the old one.","Restart the host process to reload the module if the program on disk is correct but stale in memory.","Report with the module if a clean republish still mismatches."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"Catch during view refresh and distinguish 'not found in current module' from 'failed to look up view': the former calls for republish, the latter for catalog investigation.","preventionTips":["Treat view names as stable public API; deprecate instead of rename.","Run updates in a maintenance window with view traffic paused.","Verify st_views names against the new module definition in staging before production updates."],"tags":["view","module-update","schema","metadata"],"backgroundTag":"module-schema-mismatch","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"}