{"record":{"id":"73ebf3a95f742bc3","repo":"risingwavelabs/risingwave","slug":"mv-not-found","errorCode":null,"errorMessage":"mv not found","messagePattern":"mv not found","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/ctl/src/cmd_impl/table/scan.rs","lineNumber":38,"sourceCode":"use risingwave_pb::id::TableId;\nuse risingwave_rpc_client::MetaClient;\nuse risingwave_storage::StateStore;\nuse risingwave_storage::hummock::HummockStorage;\nuse risingwave_storage::monitor::MonitoredStateStore;\nuse risingwave_storage::store::PrefetchOptions;\nuse risingwave_storage::table::TableDistribution;\nuse risingwave_storage::table::batch_table::BatchTable;\nuse risingwave_stream::common::table::state_table::{StateTable, StateTableBuilder};\n\nuse crate::CtlContext;\nuse crate::common::HummockServiceOpts;\n\npub async fn get_table_catalog(meta: MetaClient, mv_name: String) -> Result<TableCatalog> {\n    let mvs = meta.risectl_list_state_tables().await?;\n    let mv = mvs\n        .iter()\n        .find(|x| x.name == mv_name)\n        .ok_or_else(|| anyhow!(\"mv not found\"))?\n        .clone();\n    Ok(TableCatalog::from(&mv))\n}\n\npub async fn get_table_catalog_by_id(meta: MetaClient, table_id: TableId) -> Result<TableCatalog> {\n    let mvs = meta.risectl_list_state_tables().await?;\n    let mv = mvs\n        .iter()\n        .find(|x| x.id == table_id)\n        .ok_or_else(|| anyhow!(\"mv not found\"))?\n        .clone();\n    Ok(TableCatalog::from(&mv))\n}\n\npub fn print_table_catalog(table: &TableCatalog) {\n    println!(\"{:#?}\", table);\n}\n","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/ctl/src/cmd_impl/table/scan.rs#L20-L56","documentation":"get_table_catalog lists all state tables from meta and finds the one whose name equals mv_name. If no table matches, it returns this error wrapped in anyhow, so callers cannot resolve a TableCatalog for the requested name.","triggerScenarios":"Calling scan/do_bench (or get_table_catalog directly) with a table name that does not exist in the cluster, is misspelled, or has been dropped.","commonSituations":"Typos in the mv/table name; table dropped between listing and lookup; using a materialized view name created after the risectl session's meta snapshot.","solutions":["Run `risectl meta list-tables` (or equivalent) to see exact table names and correct the spelling","Recreate the table/mv if it was dropped","Use get_table_catalog_by_id with a valid table id if the name lookup keeps failing"],"exampleFix":"// before\nscan(meta, \"my_mv_typo\".into(), ...)\n// after\nscan(meta, \"my_mv\".into(), ...)","handlingStrategy":"try-catch","validationCode":"let names: Vec<_> = meta.risectl_list_state_tables().await?\n    .into_iter().map(|t| t.name).collect();\nif !names.contains(&mv_name) {\n    return Err(anyhow!(\"table {} not found; available: {:?}\", mv_name, names));\n}","typeGuard":null,"tryCatchPattern":"match get_table_catalog(meta.clone(), name.clone()).await {\n    Ok(catalog) => { /* proceed */ }\n    Err(e) if e.to_string().contains(\"mv not found\") => {\n        eprintln!(\"table '{}' not found; list tables first\", name);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["List state tables to confirm the name before scanning","Prefer stable table ids over names in scripts","Watch for dropped/renamed tables between sessions"],"tags":["rust","risingwave","not-found","catalog"],"backgroundTag":"entity-not-found","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}