{"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":null,"httpStatus":null,"severity":"error","filePath":"crates/core/src/host/module_host.rs","lineNumber":1192,"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":1174,"sourceCodeEnd":1210,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/core/src/host/module_host.rs#L1174-L1210","documentation":"A consistency check while resolving a view for refresh: the is_anonymous flag stored in the st_views catalog row must equal the flag in the current module definition. A mismatch means the view's anonymous-ness changed between the catalog write and the loaded module — schema drift during an update or an in-flight refresh.","triggerScenarios":"A module update flips a view between anonymous and named while refresh state from the old schema is applied; interrupted publishes leaving half-updated catalog flags; two module versions disagreeing on the view's declaration.","commonSituations":"Editing view declarations (anonymous vs named) between publishes; racing a subscription or view refresh against publish; rolling back to an older module version after a schema change.","solutions":["Re-publish the module so catalog flags are rewritten to match the current definitions.","If persistent, recreate the database to reset view catalog state.","Do not change a view's anonymous flag while refreshes for it are in flight; publish when the database is idle.","Report the two module versions involved if it recurs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await refreshViews(db);\n} catch (e) {\n  if (String(e).includes('is_anonymous=')) {\n    await spacetimePublish(dbName, modulePath); // rewrite catalog flags to match module\n    return refreshViews(db);\n  }\n  throw e;\n}","preventionTips":["Do not flip a view between anonymous and named while refreshes are in flight.","Publish when the database is idle.","Keep a single declaration style per view across publishes; change flags deliberately and republish."],"tags":["spacetimedb","views","schema-drift","anonymous-views","module-update"],"backgroundTag":"schema-drift","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}