{"record":{"id":"88ebe49aa3968178","repo":"clockworklabs/SpacetimeDB","slug":"call-http-handler-dunder-export-is-a-function-wi","errorCode":null,"errorMessage":"{CALL_HTTP_HANDLER_DUNDER} export is a function with incorrect type: {err}","messagePattern":"(.+?) export is a function with incorrect type: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/core/src/host/wasmtime/wasmtime_module.rs","lineNumber":499,"sourceCode":"        export\n            .into_func()\n            .unwrap_or_else(|| panic!(\"{CALL_VIEW_ANON_DUNDER} export is not a function\"))\n            .typed(store)\n            .unwrap_or_else(|err| panic!(\"{CALL_VIEW_ANON_DUNDER} export is a function with incorrect type: {err}\")),\n    )\n}\n\n/// Look up the `instance`'s export named by [`CALL_HTTP_HANDLER_DUNDER`].\n///\n/// Similar to [`get_call_procedure`], but for HTTP handlers.\nfn get_call_http_handler(store: &mut Store<WasmInstanceEnv>, instance: &Instance) -> Option<CallHttpHandlerType> {\n    let export = instance.get_export(store.as_context_mut(), CALL_HTTP_HANDLER_DUNDER)?;\n    Some(\n        export\n            .into_func()\n            .unwrap_or_else(|| panic!(\"{CALL_HTTP_HANDLER_DUNDER} export is not a function\"))\n            .typed(store)\n            .unwrap_or_else(|err| panic!(\"{CALL_HTTP_HANDLER_DUNDER} export is a function with incorrect type: {err}\")),\n    )\n}\n\n// `__call_procedure__` takes the same arguments as `__call_reducer__`.\ntype CallProcedureType = CallReducerType;\n\n/// The function signature of `__call_reducer__`\ntype CallReducerType = TypedFunc<\n    (\n        // ReducerId\n        u32,\n        // sender_0\n        u64,\n        // sender_1\n        u64,\n        // sender_2\n        u64,\n        // sender_3","sourceCodeStart":481,"sourceCodeEnd":517,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/core/src/host/wasmtime/wasmtime_module.rs#L481-L517","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"use wasmtime::{Engine, Module, ExternType};\n\nfn http_handler_signature_matches(engine: &Engine, wasm: &[u8], expected: &str) -> Result<(), String> {\n    let module = Module::new(engine, wasm).map_err(|e| e.to_string())?;\n    if let Some(exp) = module.get_export(\"__call_http_handler__\") {\n        if let ExternType::Func(f) = exp.ty() {\n            let sig = format!(\"{f:?}\");\n            if !sig.contains(expected) {\n                return Err(format!(\"__call_http_handler__ signature {sig} does not match {expected}\"));\n            }\n        }\n    }\n    Ok(())\n}","typeGuard":"fn is_func_export(ty: &ExternType) -> bool { matches!(ty, ExternType::Func(_)) }","tryCatchPattern":null,"preventionTips":["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."],"tags":["wasm","wasmtime","abi-mismatch","http-handler","spacetimedb"],"backgroundTag":"wasm-abi-mismatch","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}