clockworklabs/SpacetimeDB · error · anyhow::Error
Procedure ` ` not found
Error message
Procedure `{name}` not found What it means
function_to_procedure_call_params resolves the requested procedure through module_def.procedure_by_name_with_module; when no procedure with that name exists in the current program (including submodules), scheduling fails with 'Procedure `{name}` not found'. Procedures are the submodule entry points, distinct from reducers.
Solutions
- Verify the procedure name against the published program.
- Regenerate tooling/bindings after renames or submodule changes.
- Use generated constants rather than string literals.
- Confirm the submodule exporting the procedure is part of the publish.
Example fix
// before let p = function_to_procedure_call_params(&module, "startGame", args, at)?; // Procedure `startGame` not found // after let p = function_to_procedure_call_params(&module, "start_game", args, at)?;
Defensive patterns
Strategy: validation
Validate before calling
if module.module_def.procedure_by_name_with_module(name).is_none() {
return Err(anyhow::anyhow!("cannot schedule unknown procedure `{name}`"));
} Try / catch
Catch scheduling errors and list the module's procedure names in the diagnostic.
Prevention
- Keep procedure names stable across releases.
- Validate names against the live module catalog in CI.
- Do not assume reducer and procedure namespaces are interchangeable.
When it happens
Trigger: Scheduling a procedure that was renamed or removed, that lives in a submodule not included in the publish, or that is misspelled; using a reducer's name where a procedure name is required.
Common situations: Refactors moving procedures between submodules; stale tooling after a module update; name shadowing across submodules resolving differently than expected.
Related errors
- Reducer ` ` not found
- AddConstraint: constraint
- AddSequence: sequence
- Invalid procedure signature.
- NO_SUCH_PROCEDURE
AI-assisted analysis of clockworklabs/SpacetimeDB@fdd647dfac (2026-08-20).
Data as JSON: /api/errors/bb99acad32cf0ab6.
Report an issue: GitHub.
Appendix: source
Thrown at crates/core/src/host/scheduler.rs:1008
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"));
};
let args = args
.into_tuple_for_def(owning, def)
.map_err(InvalidProcedureArguments)?;
let (ts, instant) = scheduled_call_time(at);
Ok((ts, instant, CallProcedureParams::from_system(ts, identity, id, args)))
}
fn scheduled_call_time(at: Option<Timestamp>) -> (Timestamp, Instant) {
// The timestamp we tell the function it's running at will be
// at least the timestamp it was scheduled to run at.
let now = Timestamp::now();
let ts = at.unwrap_or(now).max(now);
let instant = Instant::now() + ts.duration_since(now).unwrap_or(Duration::ZERO);
(ts, instant)
}
View on GitHub (pinned to fdd647dfac)