risingwavelabs/risingwave · error · AccessError
Cannot parse value ` ` with type ` ` into expected type
Error message
Cannot parse value `{value}` with type `{got}` into expected type `{expected}` What it means
AccessError::TypeError in src/connector/codec/src/decoder/mod.rs:30. Thrown when a decoded value cannot be parsed/coerced into the expected RisingWave type: the value's actual runtime type (`got`) differs from the target column type (`expected`).
Solutions
- Fix the upstream producer to emit values matching the declared column types
- Recreate the RW source/table with types matching the payload (e.g. change INTEGER to VARCHAR if payload is textual)
- Add a cast in the downstream materialized view, e.g. `CAST(field AS VARCHAR)`, after declaring the column permissively
- Inspect the `value`, `got`, `expected` fields in the error to pinpoint the exact offending record and field
Example fix
-- before count INTEGER -- after (payload sends "123" as string) count VARCHAR -- then use count::INTEGER in queries
Defensive patterns
Strategy: validation
Validate before calling
fn value_matches_expected(v: &serde_json::Value, expected: &str) -> bool {
match (expected, v) {
("integer" | "bigint", serde_json::Value::Number(n)) => n.is_i64() || n.is_u64(),
("varchar", serde_json::Value::String(_)) => true,
("boolean", serde_json::Value::Bool(_)) => true,
_ => false,
}
} Try / catch
match accessor.access(record, field) {
Ok(v) => v,
Err(AccessError::TypeError { expected, got, value }) => {
tracing::warn!(%expected, %got, %value, "type mismatch; coercing");
// fall back to string decode or default
}
Err(e) => return Err(e.into()),
} Prevention
- Validate payload samples against the declared schema in CI before deploying sources
- Pin producer field types; avoid implicit upstream type changes
- Prefer permissive column types (VARCHAR/JSONB) where payloads are heterogeneous
When it happens
Trigger: A decoder accessor converts a raw value (JSON/Avro/Protobuf datum) into a RisingWave datum of the expected physical type and the wire value is of another type — e.g. a JSON string "abc" decoded into an INTEGER column, or a number decoded into a VARCHAR column without conversion.
Common situations: Producers writing wrong-typed values (sending strings for numeric fields, nulls as strings); schema registry mismatch between declared and actual Avro union branch; type changed upstream after the RW table was created.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- {0}
- argument type mismatch, expect
- Array error
- Can't cast string to date (expected format is YYYY-MM-DD)
- Can't cast string to time
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/e2ecd9833621f271.
Report an issue: GitHub.
Appendix: source
Thrown at src/connector/codec/src/decoder/mod.rs:30
// See the License for the specific language governing permissions and
// limitations under the License.
pub mod avro;
pub mod json;
pub mod protobuf;
pub mod utils;
use risingwave_common::error::NotImplemented;
use risingwave_common::types::{DataType, Datum, DatumCow, ToOwnedDatum};
use thiserror::Error;
use thiserror_ext::Macro;
#[derive(Error, Debug, Macro)]
#[thiserror_ext(macro(mangle, path = "crate::decoder"))]
pub enum AccessError {
#[error("Undefined field `{name}` at `{path}`")]
Undefined { name: String, path: String },
#[error("Cannot parse value `{value}` with type `{got}` into expected type `{expected}`")]
TypeError {
expected: String,
got: String,
value: String,
},
#[error("Unsupported data type `{ty}`")]
UnsupportedType { ty: String },
/// CDC auto schema change specific error that may include table context
#[error("CDC auto schema change error: unsupported data type `{ty}` in table `{table_name}`")]
CdcAutoSchemaChangeError { ty: String, table_name: String },
#[error("Unsupported additional column `{name}`")]
UnsupportedAdditionalColumn { name: String },
#[error("Fail to convert protobuf Any into jsonb: {0}")]
ProtobufAnyToJson(#[source] serde_json::Error),
View on GitHub (pinned to 6469eb736d)