nautechsystems/nautilus_trader · error

Redis version not available

Error message

Redis version not available

What it means

get_redis_version queries Redis via INFO (looking for a `redis_version:` line) and parses it into a SemVer. If no INFO line starts with `redis_version:` the bailing if-let reports the version is unavailable, because the parser cannot proceed without it. The library needs the version to gate compatibility checks for the Redis connection.

Source

Thrown at crates/infrastructure/src/redis/mod.rs:257

    if config.use_instance_id {
        write!(stream_key, "{instance_id}").expect("writing to String cannot fail");
        stream_key.push(REDIS_DELIMITER);
    }

    stream_key.push_str(&config.streams_prefix);
    stream_key
}

async fn get_redis_version(conn: &mut redis::aio::ConnectionManager) -> anyhow::Result<SemVer> {
    let info: String = redis::cmd("INFO").query_async(conn).await?;
    let Some(version_str) = info.lines().find_map(|line| {
        if line.starts_with("redis_version:") {
            line.split(':').nth(1).map(|s| s.trim().to_string())
        } else {
            None
        }
    }) else {
        anyhow::bail!("Redis version not available");
    };

    SemVer::parse(&version_str)
}

#[cfg(test)]
mod tests {
    use rstest::rstest;
    use serde_json::json;

    use super::*;
    use crate::redis::cache::RedisCacheConfig;

    #[rstest]
    fn test_get_redis_url_default_values() {
        let config: RedisCacheConfig = serde_json::from_value(json!({})).unwrap();
        let (url, redacted_url) = get_redis_url(&config);
        assert_eq!(url, "redis://127.0.0.1:6379");

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Connect directly to a real Redis server whose INFO command returns the standard `redis_version:` field
  2. Check what the endpoint returns with redis-cli: run `redis-cli INFO server | grep redis_version` to verify the field exists
  3. If behind a proxy, bypass it for the version probe or upgrade to a proxy that forwards full INFO output
  4. Log the full INFO response to confirm the payload shape the server actually returns
Defensive patterns

Strategy: fallback

Validate before calling

// before calling create_redis_connection
let info: String = redis::cmd("INFO").query(&mut conn)?;
if !info.contains("redis_version:") {
    eprintln!("endpoint does not expose redis_version; check server/proxy");
}

Try / catch

match create_redis_connection(&cfg) {
    Err(e) if e.to_string().contains("Redis version not available") => {
        // fall back to a compatible-mode client or alert ops
    }
    other => other?,
}

Prevention

When it happens

Trigger: Connecting via create_redis_connection when the server's INFO output contains no `redis_version:` line — e.g. connecting to a Redis-compatible proxy (KeyDB variants, Twemproxy, some managed gateways) that strips the INFO payload, or a non-Redis server on the endpoint.

Common situations: Pointing the client at a proxy/load balancer instead of a real Redis node; using managed services with sanitized INFO responses; misconfigured connection strings hitting an unrelated service on the Redis port.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/db5bed622285f9df. Report an issue: GitHub.