{"record":{"id":"4423f0b21094b716","repo":"risingwavelabs/risingwave","slug":"unexpected-statement-type","errorCode":null,"errorMessage":"unexpected statement type: {:?}","messagePattern":"unexpected statement type: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/frontend/src/handler/create_table.rs","lineNumber":2300,"sourceCode":"    TableJobType,\n)> {\n    let Statement::CreateTable {\n        columns,\n        constraints,\n        source_watermarks,\n        append_only,\n        on_conflict,\n        with_version_columns,\n        wildcard_idx,\n        cdc_table_info,\n        format_encode,\n        include_column_options,\n        engine,\n        with_options,\n        ..\n    } = statement\n    else {\n        panic!(\"unexpected statement type: {:?}\", statement);\n    };\n\n    let format_encode = format_encode\n        .clone()\n        .map(|format_encode| format_encode.into_v2_with_warning());\n\n    let engine = match engine {\n        risingwave_sqlparser::ast::Engine::Hummock => Engine::Hummock,\n        risingwave_sqlparser::ast::Engine::Iceberg => Engine::Iceberg,\n    };\n\n    let is_drop_connector =\n        original_catalog.associated_source_id().is_some() && format_encode.is_none();\n    if is_drop_connector {\n        debug_assert!(\n            source_watermarks.is_empty()\n                && include_column_options.is_empty()\n                && with_options","sourceCodeStart":2282,"sourceCodeEnd":2318,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/handler/create_table.rs#L2282-L2318","documentation":"`generate_stream_graph_for_replace_table` destructures a `CreateStatement` with a let-else; any other statement type reaches a `panic!`. This is an internal invariant violation: callers should only pass CREATE TABLE/SOURCE statements suitable for table replacement.","triggerScenarios":"Calling the replace-table planning path with a statement that is not a `CreateStatement` — e.g. an internal bug passing `CreateSource` variants lacking those fields or a completely different statement kind through `get_replace_table_plan`.","commonSituations":"Hitting this during `ALTER TABLE ... ADD COLUMN` / replace workflows after an upgrade; a RisingWave bug rather than user error.","solutions":["Verify the SQL statement being replaced is a CREATE TABLE statement created with connector semantics","If reproducible with normal SQL, file a RisingWave bug with the statement and version","Check RisingWave version for known fixes to replace-table planning"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match replace_table_plan(stmt) {\n    Err(e) if e.to_string().contains(\"unexpected statement type\") => {\n        // internal bug path: log statement, report to RisingWave\n    }\n    other => other?,\n}","preventionTips":["Only pass CREATE TABLE statements into replace-table planning paths","Keep RisingWave updated; this panic indicates a bug, not user error"],"tags":["panic","internal","planner"],"backgroundTag":"internal-invariant-violation","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"}