{"record":{"id":"4cca251a8df3a639","repo":"clockworklabs/SpacetimeDB","slug":"reducer-name-not-found","errorCode":null,"errorMessage":"Reducer `{name}` not found","messagePattern":"Reducer `(.+?)` not found","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/core/src/host/scheduler.rs","lineNumber":990,"sourceCode":"            function_to_call_params(module, &function_name, args, None)?\n        }\n    }))\n}\n\nfn function_to_reducer_call_params(\n    module: &ModuleInfo,\n    name: &str,\n    args: FunctionArgs,\n    at: Option<Timestamp>,\n) -> anyhow::Result<(Timestamp, Instant, CallReducerParams)> {\n    let identity = module.database_identity;\n\n    // Find the reducer and deserialize the arguments.\n    // Use the owning module's typespace (not necessarily the root's) so that type-index\n    // references inside the def are resolved correctly for submodules.\n    let module = &module.module_def;\n    let Some((id, def, owning)) = module.reducer_by_name_with_module(name) else {\n        return Err(anyhow!(\"Reducer `{name}` not found\"));\n    };\n    let args = args.into_tuple_for_def(owning, def).map_err(InvalidReducerArguments)?;\n\n    let (ts, instant) = scheduled_call_time(at);\n    Ok((ts, instant, CallReducerParams::from_system(ts, identity, id, args)))\n}\n\nfn function_to_procedure_call_params(\n    module: &ModuleInfo,\n    name: &str,\n    args: FunctionArgs,\n    at: Option<Timestamp>,\n) -> anyhow::Result<(Timestamp, Instant, CallProcedureParams)> {\n    let identity = module.database_identity;\n\n    let module = &module.module_def;\n    let Some((id, def, owning)) = module.procedure_by_name_with_module(name) else {\n        return Err(anyhow!(\"Procedure `{name}` not found\"));","sourceCodeStart":972,"sourceCodeEnd":1008,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/fdd647dfac506d0967cc4492e9fce380706c94cb/crates/core/src/host/scheduler.rs#L972-L1008","documentation":"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).","triggerScenarios":"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.","commonSituations":"Stale client bindings after a module refactor; copy-paste of reducer names; renaming reducers in a release without updating schedulers or CLI scripts.","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."],"exampleFix":"// before\nscheduler.schedule_reducer(\"creat_user\", args, None)?; // Reducer `creat_user` not found\n\n// after\nscheduler.schedule_reducer(\"create_user\", args, None)?;","handlingStrategy":"validation","validationCode":"if module.module_def.reducer_by_name_with_module(name).is_none() {\n    return Err(anyhow::anyhow!(\"cannot schedule unknown reducer `{name}`\"));\n}","typeGuard":null,"tryCatchPattern":"Catch the scheduler error and report the module's available reducer names alongside it to make the mismatch obvious.","preventionTips":["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."],"tags":["reducer","scheduling","name-lookup","scheduler"],"backgroundTag":"function-not-found","analyzedSha":"fdd647dfac506d0967cc4492e9fce380706c94cb","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}