{"record":{"id":"2cf4c47750c50d9b","repo":"databendlabs/databend","slug":"invalid-engine","errorCode":null,"errorMessage":"invalid engine: {}","messagePattern":"invalid engine: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/query/ast/src/ast/statements/table.rs","lineNumber":958,"sourceCode":"            Engine::Delta => write!(f, \"DELTA\"),\n            Engine::Paimon => write!(f, \"PAIMON\"),\n        }\n    }\n}\n\nimpl From<&str> for Engine {\n    fn from(s: &str) -> Self {\n        match s.to_lowercase().as_str() {\n            \"null\" => Engine::Null,\n            \"memory\" => Engine::Memory,\n            \"fuse\" => Engine::Fuse,\n            \"materialized_view\" => Engine::MaterializedView,\n            \"view\" => Engine::View,\n            \"random\" => Engine::Random,\n            \"iceberg\" => Engine::Iceberg,\n            \"delta\" => Engine::Delta,\n            \"paimon\" => Engine::Paimon,\n            _ => unreachable!(\"invalid engine: {}\", s),\n        }\n    }\n}\n\n#[derive(Debug, Clone, PartialEq, Eq, Drive, DriveMut, Walk, WalkMut)]\npub enum CompactTarget {\n    Block,\n    Segment,\n}\n\n#[derive(Debug, Clone, PartialEq, Drive, DriveMut, Walk, WalkMut)]\npub enum OptimizeTableAction {\n    Compact { target: CompactTarget },\n}\n\nimpl Display for OptimizeTableAction {\n    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {\n        match self {","sourceCodeStart":940,"sourceCodeEnd":976,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/ast/src/ast/statements/table.rs#L940-L976","documentation":"This `unreachable!(\"invalid engine: {}\", s)` fires in the `FromStr`-style parser for the `Engine` enum in table.rs. Any engine string outside the recognized list (materialized_view, view, random, iceberg, delta, paimon, and the other matched arms) causes an unrecoverable panic instead of returning a parse error.","triggerScenarios":"Passing an unrecognized engine name string into the engine parser, e.g. when deserializing or validating a `CREATE TABLE ... ENGINE = <name>` where `<name>` is not one of the supported engines.","commonSituations":"Typo'd engine names in SQL or config (e.g. `merge_tree` casing/spacing mistakes), engines added in newer Databend versions used against older code, or programmatic construction of table options with an invalid engine value.","solutions":["Use a supported engine name exactly as listed in the match arms (e.g. `MergeTree`, `View`, `Iceberg`)","Check engine-name spelling and normalization (lowercasing is applied upstream; verify the value reaching this code)","Upgrade Databend if the engine exists only in a newer release","Change the parser to return an `Err` with `invalid engine: {}` instead of panicking, so users get a proper error"],"exampleFix":"// before\n_ => unreachable!(\"invalid engine: {}\", s),\n// after\n_ => Err(ErrorCode::TableEngineNotSupported(format!(\n    \"invalid engine: {}\",\n    s\n))),","handlingStrategy":"validation","validationCode":"SUPPORTED_ENGINES = {\"merge_tree\", \"view\", \"materialized_view\", \"random\", \"iceberg\", \"delta\", \"paimon\", \"null\", \"memory\"}\nif engine_name.lower() not in SUPPORTED_ENGINES:\n    raise ValueError(f\"unsupported engine: {engine_name}\")","typeGuard":"fn is_supported_engine(s: &str) -> bool {\n    matches!(s.to_ascii_lowercase().as_str(),\n        \"merge_tree\" | \"view\" | \"materialized_view\" | \"random\"\n        | \"iceberg\" | \"delta\" | \"paimon\")\n}","tryCatchPattern":"// prefer the parser returning Err over panicking\nlet engine = Engine::from_str(s)\n    .map_err(|e| format!(\"invalid engine '{}': {}\", s, e))?;","preventionTips":["Validate engine names against the release's supported list before issuing CREATE TABLE","Normalize casing/whitespace of engine identifiers early","When adopting a new engine, confirm your Databend version supports it","Convert unreachable!() into a proper parse error so invalid input yields a user-facing message"],"tags":["rust","ast","enum","engine","panic"],"backgroundTag":"invalid-enum-value","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}