clockworklabs/SpacetimeDB · critical

{CALL_VIEW_ANON_DUNDER} export is a function with incorrect

Error message

{CALL_VIEW_ANON_DUNDER} export is a function with incorrect type: {err}

What it means

The `__call_view_anon__` export exists and is a function, but its wasm signature does not match `CallViewAnonType`, so `TypedFunc::typed` fails and the host panics. Anonymous views pass a different argument shape than named views, and this build expects a specific one. The usual cause is a module compiled against a different SDK/server ABI revision.

Source

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

        export
            .into_func()
            .unwrap_or_else(|| panic!("{CALL_VIEW_DUNDER} export is not a function"))
            .typed(store)
            .unwrap_or_else(|err| panic!("{CALL_VIEW_DUNDER} export is a function with incorrect type: {err}")),
    )
}

/// Look up the `instance`'s export named by [`CALL_VIEW_ANON_DUNDER`].
///
/// Similar to [`get_call_procedure`], but for anonymous views.
fn get_call_view_anon(store: &mut Store<WasmInstanceEnv>, instance: &Instance) -> Option<CallViewAnonType> {
    let export = instance.get_export(store.as_context_mut(), CALL_VIEW_ANON_DUNDER)?;
    Some(
        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__`.

View on GitHub (pinned to 6dee26c6ef)

Solutions

  1. Rebuild the module with the SDK matching the running server and republish.
  2. Verify the export signature with wasm-objdump/wasm2wat against a freshly generated reference module.
  3. If maintaining a fork, align your entry-point signature with the server's CallViewAnonType definition.
Defensive patterns

Strategy: type-guard

Validate before calling

use wasmtime::{Engine, Module, ExternType};

fn anon_view_signature_matches(engine: &Engine, wasm: &[u8], expected_params: usize) -> Result<(), String> {
    let module = Module::new(engine, wasm).map_err(|e| e.to_string())?;
    if let Some(exp) = module.get_export("__call_view_anon__") {
        if let ExternType::Func(f) = exp.ty() {
            if f.params().len() != expected_params {
                return Err(format!("__call_view_anon__ has {} params, expected {expected_params}", f.params().len()));
            }
        }
    }
    Ok(())
}

Type guard

fn is_func_export(ty: &ExternType) -> bool { matches!(ty, ExternType::Func(_)) }

Prevention

When it happens

Trigger: Publishing a module whose anonymous-view entry signature (argument hash / sender parameters) differs from the TypedFunc type this server binds.

Common situations: Upgrading the server across a release that changed anonymous view calling conventions while keeping the old module artifact; mixing modules built by different bindgen versions in one deployment.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20). Data as JSON: /api/errors/91275eac6188fd74. Report an issue: GitHub.