{"record":{"id":"0efb78bb34f38e65","repo":"elsa-workflows/elsa-core","slug":"activity-actinv-activityname-not-found-in-registry","errorCode":null,"errorMessage":"Activity '{actInv.ActivityName}' not found in registry","messagePattern":"Activity '(.+?)' not found in registry","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Dsl.ElsaScript/Compiler/ElsaScriptCompiler.cs","lineNumber":187,"sourceCode":"    {\n        // Try to find the activity type by name - try several strategies\n        var activityDescriptor = await activityRegistryLookupService.FindAsync(actInv.ActivityName);\n\n        // If not found, try with \"Elsa.\" prefix\n        if (activityDescriptor == null)\n        {\n            activityDescriptor = await activityRegistryLookupService.FindAsync($\"Elsa.{actInv.ActivityName}\");\n        }\n\n        // If still not found, search by descriptor name\n        if (activityDescriptor == null)\n        {\n            activityDescriptor = await activityRegistryLookupService.FindAsync(d => d.Name == actInv.ActivityName);\n        }\n\n        if (activityDescriptor == null)\n        {\n            throw new InvalidOperationException($\"Activity '{actInv.ActivityName}' not found in registry\");\n        }\n\n        var activityType = activityDescriptor.ClrType;\n\n        // Separate named and positional arguments\n        var namedArgs = actInv.Arguments.Where(a => a.Name != null).ToList();\n        var positionalArgs = actInv.Arguments.Where(a => a.Name == null).ToList();\n\n        IActivity activity;\n\n        // If we have positional arguments, try to find a matching constructor\n        if (positionalArgs.Any())\n        {\n            activity = InstantiateActivityUsingConstructor(activityType, positionalArgs);\n        }\n        else\n        {\n            // No positional arguments, use default constructor","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Dsl.ElsaScript/Compiler/ElsaScriptCompiler.cs#L169-L205","documentation":"When compiling an activity invocation, ElsaScriptCompiler looks the activity up by name in the activity registry (activityRegistryLookupService.FindAsync). If no descriptor matches the invoked name, it throws InvalidOperationException stating the activity was not found in the registry. The script is calling an activity Elsa does not know about in the current host.","triggerScenarios":"Calling an activity by name in an ElsaScript while the registry (populated from installed feature packages) has no descriptor whose Name equals the invoked name — e.g. name typos, casing differences, or the module providing the activity not registered with the host.","commonSituations":"Misspelled activity name in the script, missing Elsa feature package/UseX registration on the server, activity registered only under a different name/type, or the compiler built with a narrower registry lookup scope.","solutions":["Correct the activity name in the script to match the registry (check casing).","Register the module/feature that provides the activity with the workflow host (e.g. UseHttp(), UseTimers()).","Verify with the Activity Registry what names are available; print candidate names for the invoked type.","Catch InvalidOperationException from the compiler and report the unknown activity to the script author."],"exampleFix":"// before\nawait compile(\"sendMail(to: x)\"); // activity not installed\n// after\nservices.AddElsa(elsa => elsa.UseSendMail()); // register the module first\nawait compile(\"sendMail(to: x)\");","handlingStrategy":"validation","validationCode":"const known = await activityRegistryClient.listNames(); const missing = script.activityNames.filter(n => !known.includes(n)); if (missing.length) throw new Error('Unknown activities: ' + missing.join(', '));","typeGuard":"function isKnownActivity(name, registry) { return registry.some(d => d.name === name); }","tryCatchPattern":"try { await compileScript(script); } catch (InvalidOperationException ex) when (ex.Message.Contains(\"not found in registry\")) { suggestMatchingRegistryNames(ex); }","preventionTips":["Register all feature packages providing the activities your scripts use.","Validate activity names against the registry before compiling.","Use editor autocomplete backed by the Activity Registry to prevent typos.","Keep script authoring environments' installed modules in sync with production."],"tags":["dsl","activity-registry","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}