risingwavelabs/risingwave · error · HummockError

Encode error: {0}

Error message

Encode error: {0}

What it means

A value failed to serialize (encode) before being written by Hummock, and the underlying encoder returned a string description of the problem. Hummock wraps this as an EncodeError so storage callers get a uniform error type. The String payload carries the encoder's message.

Source

Thrown at src/storage/src/hummock/error.rs:33

use risingwave_object_store::object::ObjectError;
use risingwave_pb::id::TableId;
use thiserror::Error;
use thiserror_ext::AsReport;
use tokio::sync::oneshot::error::RecvError;

// TODO(error-handling): should prefer use error types than strings.
#[derive(Error, thiserror_ext::ReportDebug, thiserror_ext::Arc)]
#[thiserror_ext(newtype(name = HummockError, backtrace))]
pub enum HummockErrorInner {
    #[error("Magic number mismatch: expected {expected}, found: {found}")]
    MagicMismatch { expected: u32, found: u32 },
    #[error("Invalid format version: {0}")]
    InvalidFormatVersion(u32),
    #[error("Checksum mismatch: expected {expected}, found: {found}")]
    ChecksumMismatch { expected: u64, found: u64 },
    #[error("Invalid block")]
    InvalidBlock,
    #[error("Encode error: {0}")]
    EncodeError(String),
    #[error("Decode error: {0}")]
    DecodeError(String),
    #[error("ObjectStore failed with IO error: {0}")]
    ObjectIoError(
        #[from]
        #[backtrace]
        ObjectError,
    ),
    #[error("Meta error: {0}")]
    MetaError(String),
    #[error("SharedBuffer error: {0}")]
    SharedBufferError(String),
    #[error("Wait epoch error: {0}")]
    WaitEpoch(String),
    #[error("Next epoch error: {0}")]
    NextEpoch(String),
    #[error("Change log retention miss: table {table_id}, epoch {epoch}")]

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Read the wrapped String message to identify which encoder failed and fix the producing data/schema.
  2. Ensure frontend and compute/storage nodes run the same RisingWave version.
  3. Inspect the offending row/value; cast or sanitize unsupported data before writing.
  4. Reproduce and report to maintainers if encoding of a valid value fails.

Example fix

// before: writing a value the encoder rejects
INSERT INTO t VALUES ('bad-bytes');
// after
INSERT INTO t VALUES (sanitize('bad-bytes'));  -- or cast to a supported type
Defensive patterns

Strategy: validation

Validate before calling

// Validate data before insert
-- ensure values fit column types and sizes
SELECT * FROM t WHERE octet_length(col) > 1048576;  -- oversized candidates

Try / catch

// Rust
match hummock_write(batch) {
    Err(e) if e.to_string().starts_with("Encode error") => {
        // reject/inspect the batch; not retryable without fixing data
    }
    r => r?,
}

Prevention

When it happens

Trigger: Calling Hummock write paths (put/ingest/SST builder) when the prost/row encoder rejects or fails to serialize a value.

Common situations: Bugs in row encoding for exotic data types; oversized values breaking buffer assumptions; version mismatch between frontend and storage binary serializations.

Understand the failure class

Background: json.Marshal / "failed to marshal" errors in Go: why "unsupported type" happens and how to fix it — this error's family across 22 libraries.

Related errors


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