{"record":{"id":"d0960ecf338d10df","repo":"risingwavelabs/risingwave","slug":"encode-error-0-d0960e","errorCode":null,"errorMessage":"Encode error: {0}","messagePattern":"Encode error: (.+?)","errorType":"error_code","errorClass":"HummockError","httpStatus":null,"severity":"error","filePath":"src/storage/src/hummock/error.rs","lineNumber":33,"sourceCode":"use risingwave_object_store::object::ObjectError;\nuse risingwave_pb::id::TableId;\nuse thiserror::Error;\nuse thiserror_ext::AsReport;\nuse tokio::sync::oneshot::error::RecvError;\n\n// TODO(error-handling): should prefer use error types than strings.\n#[derive(Error, thiserror_ext::ReportDebug, thiserror_ext::Arc)]\n#[thiserror_ext(newtype(name = HummockError, backtrace))]\npub enum HummockErrorInner {\n    #[error(\"Magic number mismatch: expected {expected}, found: {found}\")]\n    MagicMismatch { expected: u32, found: u32 },\n    #[error(\"Invalid format version: {0}\")]\n    InvalidFormatVersion(u32),\n    #[error(\"Checksum mismatch: expected {expected}, found: {found}\")]\n    ChecksumMismatch { expected: u64, found: u64 },\n    #[error(\"Invalid block\")]\n    InvalidBlock,\n    #[error(\"Encode error: {0}\")]\n    EncodeError(String),\n    #[error(\"Decode error: {0}\")]\n    DecodeError(String),\n    #[error(\"ObjectStore failed with IO error: {0}\")]\n    ObjectIoError(\n        #[from]\n        #[backtrace]\n        ObjectError,\n    ),\n    #[error(\"Meta error: {0}\")]\n    MetaError(String),\n    #[error(\"SharedBuffer error: {0}\")]\n    SharedBufferError(String),\n    #[error(\"Wait epoch error: {0}\")]\n    WaitEpoch(String),\n    #[error(\"Next epoch error: {0}\")]\n    NextEpoch(String),\n    #[error(\"Change log retention miss: table {table_id}, epoch {epoch}\")]","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/storage/src/hummock/error.rs#L15-L51","documentation":"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.","triggerScenarios":"Calling Hummock write paths (put/ingest/SST builder) when the prost/row encoder rejects or fails to serialize a value.","commonSituations":"Bugs in row encoding for exotic data types; oversized values breaking buffer assumptions; version mismatch between frontend and storage binary serializations.","solutions":["Read the wrapped String message to identify which encoder failed and fix the producing data/schema.","Ensure frontend and compute/storage nodes run the same RisingWave version.","Inspect the offending row/value; cast or sanitize unsupported data before writing.","Reproduce and report to maintainers if encoding of a valid value fails."],"exampleFix":"// before: writing a value the encoder rejects\nINSERT INTO t VALUES ('\u0000bad-bytes');\n// after\nINSERT INTO t VALUES (sanitize('\u0000bad-bytes'));  -- or cast to a supported type","handlingStrategy":"validation","validationCode":"// Validate data before insert\n-- ensure values fit column types and sizes\nSELECT * FROM t WHERE octet_length(col) > 1048576;  -- oversized candidates","typeGuard":null,"tryCatchPattern":"// Rust\nmatch hummock_write(batch) {\n    Err(e) if e.to_string().starts_with(\"Encode error\") => {\n        // reject/inspect the batch; not retryable without fixing data\n    }\n    r => r?,\n}","preventionTips":["Keep all RisingWave components on the same version.","Sanitize or cast unsupported/exotic values before writing.","Add tests for large and edge-case row payloads."],"tags":["storage","hummock","serialization","encode"],"backgroundTag":"json-marshal-failed","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}