clockworklabs/SpacetimeDB · error · ExecutionError::Recoverable
unknown return code
Error message
unknown return code
What it means
Error "unknown return code" thrown in clockworklabs/SpacetimeDB.
Source
Thrown at crates/core/src/host/wasmtime/wasmtime_module.rs:193
fn handle_error_sink_code(code: i32, error: Vec<u8>) -> Result<(), ExecutionError> {
handle_result_sink_code(code, error).map(drop)
}
pub(super) enum ViewResultSinkError {
User(String),
UnexpectedCode(i32),
}
/// Handle the return code from a function using a result sink.
///
/// On success, returns the result bytes.
/// On failure, returns the error message.
fn handle_result_sink_code(code: i32, result: Vec<u8>) -> Result<Vec<u8>, ExecutionError> {
match code {
0 => Ok(result),
CALL_FAILURE => Err(ExecutionError::User(string_from_utf8_lossy_owned(result).into())),
_ => Err(ExecutionError::Recoverable(anyhow::anyhow!("unknown return code"))),
}
}
/// Handle the return code from a view function using a result sink.
/// For views, we treat the return code 2 as a successful return using the header format.
fn handle_view_result_sink_code(code: i32, result: Vec<u8>) -> Result<ViewReturnData, ExecutionError> {
decode_view_result_sink_code(code, result).map_err(|err| match err {
ViewResultSinkError::User(err) => ExecutionError::User(err.into()),
ViewResultSinkError::UnexpectedCode(_) => ExecutionError::Recoverable(anyhow::anyhow!("unknown return code")),
})
}
pub(super) fn decode_view_result_sink_code(code: i32, result: Vec<u8>) -> Result<ViewReturnData, ViewResultSinkError> {
match code {
0 => Ok(ViewReturnData::Rows(result.into())),
2 => Ok(ViewReturnData::HeaderFirst(result.into())),
CALL_FAILURE => Err(ViewResultSinkError::User(string_from_utf8_lossy_owned(result))),
_ => Err(ViewResultSinkError::UnexpectedCode(code)),View on GitHub (pinned to 524b4487d9)
When it happens
Trigger: Thrown at crates/core/src/host/wasmtime/wasmtime_module.rs:193 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/fdbd87347cf8fad9.
Report an issue: GitHub.