clockworklabs/SpacetimeDB · error · anyhow::Error
Reducer ` ` not found
Error message
Reducer `{name}` not found What it means
When scheduling a reducer by name, the scheduler resolves it via module_def.reducer_by_name_with_module; a None lookup yields 'Reducer `{name}` not found'. The lookup spans submodules, so the name must match an exported reducer in the currently published program exactly (case-sensitive).
Solutions
- Check the reducer name against the published module (generated bindings or catalog).
- Regenerate or refresh client tooling after renames.
- Prefer generated name constants over string literals.
- If the reducer should exist, confirm the publish included the submodule that exports it.
Example fix
// before
scheduler.schedule_reducer("creat_user", args, None)?; // Reducer `creat_user` not found
// after
scheduler.schedule_reducer("create_user", args, None)?; Defensive patterns
Strategy: validation
Validate before calling
if module.module_def.reducer_by_name_with_module(name).is_none() {
return Err(anyhow::anyhow!("cannot schedule unknown reducer `{name}`"));
} Try / catch
Catch the scheduler error and report the module's available reducer names alongside it to make the mismatch obvious.
Prevention
- Use generated bindings' constants for reducer names.
- Run a name-exists check in CI against the published module.
- Treat reducer names as stable API; deprecate before removing.
When it happens
Trigger: schedule/schedule_reducer called with a typo'd or renamed reducer; the module update removed the reducer while a client still schedules it; a case-sensitive name mismatch.
Common situations: Stale client bindings after a module refactor; copy-paste of reducer names; renaming reducers in a release without updating schedulers or CLI scripts.
Related errors
- failed to typecheck args
- Procedure ` ` not found
- Table defines a schedule, but it seems like the associated…
- Table defines multiple schedules: and . A schedule table…
- Failed to convert 'scheduled_at' to ScheduleAt
AI-assisted analysis of clockworklabs/SpacetimeDB@fdd647dfac (2026-08-20).
Data as JSON: /api/errors/4cca251a8df3a639.
Report an issue: GitHub.
Appendix: source
Thrown at crates/core/src/host/scheduler.rs:990
function_to_call_params(module, &function_name, args, None)?
}
}))
}
fn function_to_reducer_call_params(
module: &ModuleInfo,
name: &str,
args: FunctionArgs,
at: Option<Timestamp>,
) -> anyhow::Result<(Timestamp, Instant, CallReducerParams)> {
let identity = module.database_identity;
// Find the reducer and deserialize the arguments.
// Use the owning module's typespace (not necessarily the root's) so that type-index
// references inside the def are resolved correctly for submodules.
let module = &module.module_def;
let Some((id, def, owning)) = module.reducer_by_name_with_module(name) else {
return Err(anyhow!("Reducer `{name}` not found"));
};
let args = args.into_tuple_for_def(owning, def).map_err(InvalidReducerArguments)?;
let (ts, instant) = scheduled_call_time(at);
Ok((ts, instant, CallReducerParams::from_system(ts, identity, id, args)))
}
fn function_to_procedure_call_params(
module: &ModuleInfo,
name: &str,
args: FunctionArgs,
at: Option<Timestamp>,
) -> anyhow::Result<(Timestamp, Instant, CallProcedureParams)> {
let identity = module.database_identity;
let module = &module.module_def;
let Some((id, def, owning)) = module.procedure_by_name_with_module(name) else {
return Err(anyhow!("Procedure `{name}` not found"));View on GitHub (pinned to fdd647dfac)