risingwavelabs/risingwave · error · BackupError

Encoding error

Error message

Encoding error: {0}

What it means

`BackupError::Encoding` wraps an underlying error raised when serializing/encoding backup payload data (e.g. protobuf/bytes conversion) fails. The original encoder error is boxed and kept as source with backtrace.

Solutions

  1. Inspect the wrapped source to see which encoder failed and on what payload.
  2. Ensure meta/backup binaries and stored metadata versions are compatible (upgrade/downgrade consistency).
  3. Retry the backup; if reproducible, report with the backtrace as it may indicate a bug.
Defensive patterns

Strategy: try-catch

Validate before calling

// Sanity-check payload before encode
fn payload_sane<T: prost::Message>(m: &T) -> bool {
    m.encoded_len() > 0
}

Try / catch

match backup.write().await {
    Err(e @ BackupError::Encoding(_)) => {
        tracing::error!(source = ?e.source(), "encode failure");
        // check version compatibility, abort rather than retry blindly
    }
    other => other?,
}

Prevention

When it happens

Trigger: Encoding a backup manifest, snapshot metadata, or data chunk before writing to backup storage when the serializer returns an error (e.g. prost encode failure, invalid utf-8, buffer conversion errors).

Common situations: Incompatible payload produced by a newer/older version of the code; corrupted in-memory structures; OOM/truncation during large payload encoding.

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/d56d50c7a7b1a1be. Report an issue: GitHub.

Appendix: source

Thrown at src/storage/backup/src/error.rs:40

    #[error("BackupStorage error: {0}")]
    BackupStorage(
        #[backtrace]
        #[source]
        BoxedError,
    ),
    #[error("MetaStorage error: {0}")]
    MetaStorage(
        #[backtrace]
        #[source]
        BoxedError,
    ),
    #[error("StateStorage error: {0}")]
    StateStorage(
        #[backtrace]
        #[source]
        BoxedError,
    ),
    #[error("Encoding error: {0}")]
    Encoding(
        #[backtrace]
        #[source]
        BoxedError,
    ),
    #[error("Decoding error: {0}")]
    Decoding(
        #[backtrace]
        #[source]
        BoxedError,
    ),
    #[error("Checksum mismatch: expected {expected}, found: {found}")]
    ChecksumMismatch { expected: u64, found: u64 },
    #[error("Meta storage is not empty before being restored")]
    NonemptyMetaStorage,
    #[error(transparent)]
    Other(
        #[from]

View on GitHub (pinned to 6469eb736d)