clockworklabs/SpacetimeDB · error

{CALL_PROCEDURE_DUNDER} returned unexpected code {code}. Pro

Error message

{CALL_PROCEDURE_DUNDER} returned unexpected code {code}. Procedures should return code 0 or trap.

What it means

Error "{CALL_PROCEDURE_DUNDER} returned unexpected code {code}. Procedures should return code 0 or trap." thrown in clockworklabs/SpacetimeDB.

Source

Thrown at crates/core/src/host/wasmtime/wasmtime_module.rs:812

                    conn_id_0,
                    conn_id_1,
                    op.timestamp.to_micros_since_unix_epoch() as u64,
                    args_source.0,
                    result_sink,
                ),
            )
            .await;

        // Close any ongoing anonymous transactions by aborting them,
        // in case of improper ABI use (start but no commit/abort).
        store.data_mut().terminate_dangling_anon_tx();

        // Close the timing span for this procedure and get the BSATN bytes of its result.
        let (stats, result_bytes) = finish_opcall(store, budget, result_sink);

        let call_result = call_result.and_then(|code| {
            (code == 0).then_some(result_bytes.into()).ok_or_else(|| {
                anyhow::anyhow!(
                    "{CALL_PROCEDURE_DUNDER} returned unexpected code {code}. Procedures should return code 0 or trap."
                )
            })
        });

        let res = module_host_actor::ProcedureExecuteResult { stats, call_result };

        // Take the last tx offset.
        // Only commits for anonymous transactions currently cause this to advance.
        let tx_offset = store.data_mut().take_procedure_tx_offset();

        (res, tx_offset)
    }

    #[tracing::instrument(level = "trace", skip_all)]
    async fn call_http_handler(
        &mut self,
        op: module_host_actor::HttpHandlerOp,

View on GitHub (pinned to 524b4487d9)

When it happens

Trigger: Thrown at crates/core/src/host/wasmtime/wasmtime_module.rs:812 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/2d1563abefbfc839. Report an issue: GitHub.