clockworklabs/SpacetimeDB · critical
{CALL_HTTP_HANDLER_DUNDER} export is a function with incorre
Error message
{CALL_HTTP_HANDLER_DUNDER} export is a function with incorrect type: {err} What it means
The `__call_http_handler__` export is a function, but its signature does not match `CallHttpHandlerType`, so typed binding fails and the host panics. The expected signature encodes how request data and the caller are passed into the module; a mismatch means the module was built for a different handler ABI. Deterministic for a given module + server pair, never transient.
Source
Thrown at crates/core/src/host/wasmtime/wasmtime_module.rs:499
export
.into_func()
.unwrap_or_else(|| panic!("{CALL_VIEW_ANON_DUNDER} export is not a function"))
.typed(store)
.unwrap_or_else(|err| panic!("{CALL_VIEW_ANON_DUNDER} export is a function with incorrect type: {err}")),
)
}
/// Look up the `instance`'s export named by [`CALL_HTTP_HANDLER_DUNDER`].
///
/// Similar to [`get_call_procedure`], but for HTTP handlers.
fn get_call_http_handler(store: &mut Store<WasmInstanceEnv>, instance: &Instance) -> Option<CallHttpHandlerType> {
let export = instance.get_export(store.as_context_mut(), CALL_HTTP_HANDLER_DUNDER)?;
Some(
export
.into_func()
.unwrap_or_else(|| panic!("{CALL_HTTP_HANDLER_DUNDER} export is not a function"))
.typed(store)
.unwrap_or_else(|err| panic!("{CALL_HTTP_HANDLER_DUNDER} export is a function with incorrect type: {err}")),
)
}
// `__call_procedure__` takes the same arguments as `__call_reducer__`.
type CallProcedureType = CallReducerType;
/// The function signature of `__call_reducer__`
type CallReducerType = TypedFunc<
(
// ReducerId
u32,
// sender_0
u64,
// sender_1
u64,
// sender_2
u64,
// sender_3View on GitHub (pinned to 6dee26c6ef)
Solutions
- Rebuild the module with the SDK version matching the server and republish.
- Compare `__call_http_handler__` params in wasm2wat output against the server's CallHttpHandlerType.
- Pin SDK, CLI, and server versions as a matched set in your deployment pipeline.
Defensive patterns
Strategy: type-guard
Validate before calling
use wasmtime::{Engine, Module, ExternType};
fn http_handler_signature_matches(engine: &Engine, wasm: &[u8], expected: &str) -> Result<(), String> {
let module = Module::new(engine, wasm).map_err(|e| e.to_string())?;
if let Some(exp) = module.get_export("__call_http_handler__") {
if let ExternType::Func(f) = exp.ty() {
let sig = format!("{f:?}");
if !sig.contains(expected) {
return Err(format!("__call_http_handler__ signature {sig} does not match {expected}"));
}
}
}
Ok(())
} Type guard
fn is_func_export(ty: &ExternType) -> bool { matches!(ty, ExternType::Func(_)) } Prevention
- Rebuild and republish handler modules with each server upgrade.
- Compare handler entry signatures against a freshly generated reference module.
- Pin SDK, CLI, and server as a matched set in deployment tooling.
When it happens
Trigger: Publishing a module whose HTTP handler entry signature differs from the TypedFunc type this server build binds (e.g. handler ABI changed between SDK versions).
Common situations: Server upgraded across an http-handler ABI change while the module artifact stayed old; CI publishing with a cached/outdated SDK; custom handler codegen in forks.
Related errors
- {CALL_PROCEDURE_DUNDER} export is a function with incorrect
- {CALL_VIEW_DUNDER} export is a function with incorrect type:
- {CALL_VIEW_ANON_DUNDER} export is a function with incorrect
- {CALL_HTTP_HANDLER_DUNDER} export is not a function
- {CALL_PROCEDURE_DUNDER} export is not a function
AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20).
Data as JSON: /api/errors/88ebe49aa3968178.
Report an issue: GitHub.