tikv/tikv · error

failed to get value of key {} in region {}: {:?}

Error message

failed to get value of key {} in region {}: {:?}

What it means

A point get in a region snapshot failed at the RocksDB layer; handle_get_value_error increments the CRITICAL_ERROR 'rocksdb get' counter and, when panic_when_unexpected_key_or_data is enabled (test/diagnostic config), sets a panic mark and panics with the key and region. Outside that mode it converts to an EngineError.

Source

Thrown at components/raftstore/src/store/region_snapshot.rs:306

        )
        .map_err(|e| EngineError::Other(box_err!(e)))?;
        let data_key = keys::data_key(key);
        self.snap
            .get_value_cf_opt(opts, cf, &data_key)
            .map_err(|e| self.handle_get_value_error(e, cf, key))
    }
}

impl<S> RegionSnapshot<S>
where
    S: Snapshot,
{
    #[inline(never)]
    fn handle_get_value_error(&self, e: EngineError, cf: &str, key: &[u8]) -> EngineError {
        CRITICAL_ERROR.with_label_values(&["rocksdb get"]).inc();
        if panic_when_unexpected_key_or_data() {
            set_panic_mark();
            panic!(
                "failed to get value of key {} in region {}: {:?}",
                log_wrappers::Value::key(key),
                self.region.get_id(),
                e,
            );
        } else {
            error!(
                "failed to get value of key in cf";
                "key" => log_wrappers::Value::key(key),
                "region" => self.region.get_id(),
                "cf" => cf,
                "error" => ?e,
            );
            e
        }
    }
}

View on GitHub (pinned to 78aedc1c81)

Solutions

  1. Inspect the underlying EngineError for RocksDB corruption or IO failure
  2. Disable panic_when_unexpected_key_or_data in production so the error propagates as a retryable region error
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at components/raftstore/src/store/region_snapshot.rs:306 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tikv/tikv@78aedc1c81 (2026-09-03). Data as JSON: /api/errors/27243fd1e8966c1f. Report an issue: GitHub.