{"record":{"id":"bb99acad32cf0ab6","repo":"clockworklabs/SpacetimeDB","slug":"procedure-name-not-found","errorCode":null,"errorMessage":"Procedure `{name}` not found","messagePattern":"Procedure `(.+?)` not found","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/core/src/host/scheduler.rs","lineNumber":1008,"sourceCode":"        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\"));\n    };\n    let args = args\n        .into_tuple_for_def(owning, def)\n        .map_err(InvalidProcedureArguments)?;\n\n    let (ts, instant) = scheduled_call_time(at);\n    Ok((ts, instant, CallProcedureParams::from_system(ts, identity, id, args)))\n}\n\nfn scheduled_call_time(at: Option<Timestamp>) -> (Timestamp, Instant) {\n    // The timestamp we tell the function it's running at will be\n    // at least the timestamp it was scheduled to run at.\n    let now = Timestamp::now();\n    let ts = at.unwrap_or(now).max(now);\n    let instant = Instant::now() + ts.duration_since(now).unwrap_or(Duration::ZERO);\n    (ts, instant)\n}\n","sourceCodeStart":990,"sourceCodeEnd":1026,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/fdd647dfac506d0967cc4492e9fce380706c94cb/crates/core/src/host/scheduler.rs#L990-L1026","documentation":"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.","triggerScenarios":"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.","commonSituations":"Refactors moving procedures between submodules; stale tooling after a module update; name shadowing across submodules resolving differently than expected.","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."],"exampleFix":"// before\nlet p = function_to_procedure_call_params(&module, \"startGame\", args, at)?; // Procedure `startGame` not found\n\n// after\nlet p = function_to_procedure_call_params(&module, \"start_game\", args, at)?;","handlingStrategy":"validation","validationCode":"if module.module_def.procedure_by_name_with_module(name).is_none() {\n    return Err(anyhow::anyhow!(\"cannot schedule unknown procedure `{name}`\"));\n}","typeGuard":null,"tryCatchPattern":"Catch scheduling errors and list the module's procedure names in the diagnostic.","preventionTips":["Keep procedure names stable across releases.","Validate names against the live module catalog in CI.","Do not assume reducer and procedure namespaces are interchangeable."],"tags":["procedure","scheduling","name-lookup","submodule"],"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"}