databendlabs/databend · error
invalid engine
Error message
invalid engine: {} What it means
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.
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
Example fix
// before
_ => unreachable!("invalid engine: {}", s),
// after
_ => Err(ErrorCode::TableEngineNotSupported(format!(
"invalid engine: {}",
s
))), Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_ENGINES = {"merge_tree", "view", "materialized_view", "random", "iceberg", "delta", "paimon", "null", "memory"}
if engine_name.lower() not in SUPPORTED_ENGINES:
raise ValueError(f"unsupported engine: {engine_name}") Type guard
fn is_supported_engine(s: &str) -> bool {
matches!(s.to_ascii_lowercase().as_str(),
"merge_tree" | "view" | "materialized_view" | "random"
| "iceberg" | "delta" | "paimon")
} Try / catch
// prefer the parser returning Err over panicking
let engine = Engine::from_str(s)
.map_err(|e| format!("invalid engine '{}': {}", s, e))?; Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Token does not belong to this ContextVar
- MEMORY_EXCEEDS_LIMIT
- verifier did not complete within the timeout.
- {}
- Temp table id used up
AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11).
Data as JSON: /api/errors/2cf4c47750c50d9b.
Report an issue: GitHub.
Appendix: source
Thrown at src/query/ast/src/ast/statements/table.rs:958
Engine::Delta => write!(f, "DELTA"),
Engine::Paimon => write!(f, "PAIMON"),
}
}
}
impl From<&str> for Engine {
fn from(s: &str) -> Self {
match s.to_lowercase().as_str() {
"null" => Engine::Null,
"memory" => Engine::Memory,
"fuse" => Engine::Fuse,
"materialized_view" => Engine::MaterializedView,
"view" => Engine::View,
"random" => Engine::Random,
"iceberg" => Engine::Iceberg,
"delta" => Engine::Delta,
"paimon" => Engine::Paimon,
_ => unreachable!("invalid engine: {}", s),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Drive, DriveMut, Walk, WalkMut)]
pub enum CompactTarget {
Block,
Segment,
}
#[derive(Debug, Clone, PartialEq, Drive, DriveMut, Walk, WalkMut)]
pub enum OptimizeTableAction {
Compact { target: CompactTarget },
}
impl Display for OptimizeTableAction {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {View on GitHub (pinned to 288d84d76e)