risingwavelabs/risingwave · error · SinkError

Redis error: {0}

Error message

Redis error: {0}

What it means

SinkError::Redis(String) in src/connector/src/sink/mod.rs:1129 wraps any failure from the Redis sink while writing/reading data through a Redis instance. It is raised when the Redis sink connector cannot complete an operation such as LPUSH/RPUSH to a list key, connection establishment, or command execution. The payload is a human-readable string (often the Display of an underlying redis-rs error) describing what went wrong.

Source

Thrown at src/connector/src/sink/mod.rs:1128

        #[source]
        #[backtrace]
        anyhow::Error,
    ),
    #[error("config error: {0}")]
    Config(
        #[source]
        #[backtrace]
        anyhow::Error,
    ),
    #[error("coordinator error: {0}")]
    Coordinator(
        #[source]
        #[backtrace]
        anyhow::Error,
    ),
    #[error("ClickHouse error: {0}")]
    ClickHouse(String),
    #[error("Redis error: {0}")]
    Redis(String),
    #[error("Http error: {0}")]
    Http(
        #[source]
        #[backtrace]
        anyhow::Error,
    ),
    #[error("Mqtt error: {0}")]
    Mqtt(
        #[source]
        #[backtrace]
        anyhow::Error,
    ),
    #[error("Nats error: {0}")]
    Nats(
        #[source]
        #[backtrace]
        anyhow::Error,

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Verify Redis connectivity from the RisingWave host (redis-cli -h <host> -p <port> ping) and fix the host/port/URL in the sink WITH options.
  2. Check the password/TLS settings in the sink definition match the Redis instance (requirepass / ACL).
  3. Run TYPE on the target key; delete or rename the key if its type conflicts with the sink's expected list type (WRONGTYPE).
  4. Inspect INFO memory on Redis; raise maxmemory or enable eviction if OOM errors are reported.
  5. Check RisingWave logs for the embedded redis-rs error detail to identify retryable I/O errors vs permanent command errors.

Example fix

// before: key 'events' already holds a string, sink LPUSH fails with WRONGTYPE
// after: delete the conflicting key before recreating the sink
// redis-cli DEL events
CREATE SINK redis_sink FROM mv WITH (
  connector = 'redis',
  redis.url = 'redis://:password@redis-host:6379'
);
Defensive patterns

Strategy: try-catch

Validate before calling

// Before creating the sink, validate Redis connectivity and key type
let client = redis::Client::open(redis_url)?;
let mut conn = client.get_connection()?;
redis::cmd("PING").query::<String>(&mut conn)?;
if let Ok(t) = redis::cmd("TYPE").arg(&key).query::<String>(&mut conn) {
    assert!(t == "none" || t == "list", "key {key} holds incompatible type {t}");
}

Type guard

fn is_redis_config_ok(url: &str) -> bool {
    url.starts_with("redis://") || url.starts_with("rediss://")
}

Try / catch

// Rust: match on the SinkError variant
match sink_result {
    Err(SinkError::Redis(msg)) if msg.contains("WRONGTYPE") => fix_key_type_and_recreate_sink(),
    Err(SinkError::Redis(msg)) if msg.contains("connection") => retry_with_backoff(),
    Err(e) => log_and_alert(&e.to_string()),
    Ok(v) => process(v),
}

Prevention

When it happens

Trigger: Using CREATE SINK ... WITH (connector='redis') and the sink fails during startup or streaming: Redis server unreachable/wrong host:port, wrong password (AUTH failure), Redis OOM (maxmemory reached), WRONGTYPE errors when writing a value to a key holding a different type, or I/O timeout during command execution.

Common situations: Redis not running or firewalled on the configured endpoint; stale Redis credentials after a rotation; trying to append to an existing key that is a string or hash instead of a list (WRONGTYPE); Redis maxmemory eviction blocking writes; connection pool exhaustion under high sink throughput.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/3943d06342ff1a69. Report an issue: GitHub.