tikv/tikv · error
it's not a titan cf option
Error message
it's not a titan cf option
What it means
RocksCfOptions wraps an enum that is either plain RocksDB or Titan options; into_titan() panics when called on a variant constructed via default()/new() (plain RocksDB) rather than default_titan(). The faulty input is a RocksCfOptions holding Options::Rocks, i.e. a Titan-specific consumer received a non-Titan config object.
Source
Thrown at components/engine_tirocks/src/cf_options.rs:45
#[inline]
pub fn default_titan() -> Self {
RocksCfOptions(Options::Titan(Default::default()))
}
#[inline]
pub(crate) fn into_rocks(self) -> CfOptions {
match self.0 {
Options::Rocks(opt) => opt,
_ => panic!("it's a titan cf option"),
}
}
#[inline]
pub(crate) fn into_titan(self) -> TitanCfOptions {
match self.0 {
Options::Titan(opt) => opt,
_ => panic!("it's not a titan cf option"),
}
}
}
impl Default for RocksCfOptions {
#[inline]
fn default() -> Self {
RocksCfOptions(Options::Rocks(Default::default()))
}
}
impl Deref for RocksCfOptions {
type Target = RawCfOptions;
#[inline]
fn deref(&self) -> &Self::Target {
match &self.0 {
Options::Rocks(opt) => opt,View on GitHub (pinned to 78aedc1c81)
Solutions
- Build the options with the Titan constructor (Options::Titan) before calling into_titan.
- Use into_rocks when the target is a plain RocksDB engine.
- Add an explicit variant check/branch instead of unconditional unwrap at the call site.
Example fix
// before let titan_cf = RocksCfOptions::new_rocks().into_titan(); // panic // after let titan_cf = RocksCfOptions::new_titan().into_titan();
Defensive patterns
Strategy: type-guard
Validate before calling
fn expects_titan(opts: &RocksCfOptions) -> bool {
matches!(opts.as_ref(), Options::Titan(_))
}
// guard before into_titan
if !expects_titan(&cf_opts) { /* construct Titan variant first */ } Type guard
fn as_titan_cf(opts: &RocksCfOptions) -> Option<&titan::CfOptions> {
match &opts.0 { Options::Titan(o) => Some(o), _ => None }
} Prevention
- When the titan feature is enabled, build CF options with the Titan constructor everywhere.
- Add compile-time or unit-test assertions that titan engine paths never construct Options::Rocks.
- Centralize engine option construction in one module so variant selection is explicit.
When it happens
Trigger: Calling into_titan on options created via the RocksDB constructor (Options::Rocks) — e.g. Titan engine setup code handed Rocks-built CF options.
Common situations: Using default/new Rocks options builders inside titan-enabled engine construction; feature-flag code paths sharing one option builder across titan and non-titan engines.
Related errors
- it's a titan cf option
- it's a titan option
- expect: ConfigValue::String, got: {:?}
- it's not a titan option
- expect: ConfigValue::String, got: {:?}
AI-assisted analysis of tikv/tikv@78aedc1c81 (2026-09-03).
Data as JSON: /api/errors/332ae069ef6b2ce0.
Report an issue: GitHub.