clockworklabs/SpacetimeDB · error
unable to encode view return value
Error message
unable to encode view return value
What it means
Error "unable to encode view return value" thrown in clockworklabs/SpacetimeDB.
Source
Thrown at crates/bindings/src/rt.rs:98
note = "where each `Ti` type implements `SpacetimeType`.",
note = ""
)]
pub trait Reducer<'de, A: Args<'de>> {
fn invoke(&self, ctx: &ReducerContext, args: A) -> ReducerResult;
}
/// Invoke a caller-specific view.
/// Returns a BSATN encoded `Vec` of rows.
pub fn invoke_view<'a, A: Args<'a>, T: ViewReturn>(
view: impl View<'a, A, T>,
ctx: ViewContext,
args: &'a [u8],
) -> Vec<u8> {
// Deserialize the arguments from a bsatn encoding.
let SerDeArgs(args) = bsatn::from_slice(args).expect("unable to decode args");
let retn = view.invoke(&ctx, args);
let mut buf = IterBuf::take();
retn.to_writer(&mut buf).expect("unable to encode view return value");
std::mem::take(&mut *buf)
}
/// A trait for types representing the execution logic of a caller-specific view.
#[expect(clippy::duplicated_attributes, reason = "false positive")]
#[diagnostic::on_unimplemented(
message = "invalid view signature",
label = "this view signature is not valid",
note = "",
note = "view signatures must match:",
note = " `Fn(&ViewContext, [T1, ...]) -> Vec<Tn> | Option<Tn>`",
note = "where each `Ti` implements `SpacetimeType`.",
note = ""
)]
pub trait View<'de, A: Args<'de>, T: ViewReturn> {
fn invoke(&self, ctx: &ViewContext, args: A) -> T;
}
/// Invoke an anonymous view.View on GitHub (pinned to 524b4487d9)
When it happens
Trigger: Thrown at crates/bindings/src/rt.rs:98 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/9a0b9c19a34eb302.
Report an issue: GitHub.