{"record":{"id":"d784c23149f75cb5","repo":"microsoft/semantic-kernel","slug":"a-message-targeting-function-message-functionnam-d784c2","errorCode":null,"errorMessage":"A message targeting function '{message.FunctionName}' has resulted in a function named '{invocableFunctions.First()}' becoming invocable. Are the function names configured correctly?","messagePattern":"A message targeting function '(.+?)' has resulted in a function named '(.+?)' becoming invocable\\. Are the function names configured correctly\\?","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Runtime.Dapr/Actors/StepActor.cs","lineNumber":290,"sourceCode":"        this._logger?.LogDebug(\"Received message from '{SourceId}' targeting function '{FunctionName}' and parameters '{Parameters}'.\", message.SourceId, message.FunctionName, messageLogParameters);\n\n        // Add the message values to the inputs for the function\n        this.AssignStepFunctionParameterValues(message);\n\n        // If we're still waiting for inputs on all of our functions then don't do anything.\n        List<string> invocableFunctions = this._inputs.Where(i => i.Value != null && i.Value.All(v => v.Value != null)).Select(i => i.Key).ToList();\n        var missingKeys = this._inputs.Where(i => i.Value is null || i.Value.Any(v => v.Value is null));\n\n        if (invocableFunctions.Count == 0)\n        {\n            string missingKeysLog() => string.Join(\", \", missingKeys.Select(k => $\"{k.Key}: {string.Join(\", \", k.Value?.Where(v => v.Value == null).Select(v => v.Key) ?? [])}\"));\n            this._logger?.LogInformation(\"No invocable functions, missing keys: {MissingKeys}\", missingKeysLog());\n            return;\n        }\n\n        // A message can only target one function and should not result in a different function being invoked.\n        var targetFunction = invocableFunctions.FirstOrDefault((name) => name == message.FunctionName) ??\n            throw new InvalidOperationException($\"A message targeting function '{message.FunctionName}' has resulted in a function named '{invocableFunctions.First()}' becoming invocable. Are the function names configured correctly?\").Log(this._logger);\n\n        this._logger?.LogInformation(\"Step with Id `{StepId}` received all required input for function [{TargetFunction}] and is executing.\", this.Name, targetFunction);\n\n        // Concat all the inputs and run the function\n        KernelArguments arguments = new(this._inputs[targetFunction]!);\n        if (!this._functions.TryGetValue(targetFunction, out KernelFunction? function) || function == null)\n        {\n            throw new InvalidOperationException($\"Function {targetFunction} not found in plugin {this.Name}\").Log(this._logger);\n        }\n\n        // Invoke the function, catching all exceptions that it may throw, and then post the appropriate event.\n#pragma warning disable CA1031 // Do not catch general exception types\n        try\n        {\n            this?._logger?.LogInformation(\"Invoking function {FunctionName} with arguments {Arguments}\", targetFunction, arguments);\n            FunctionResult invokeResult = await this.InvokeFunction(function, this._kernel, arguments).ConfigureAwait(false);\n\n            this?.Logger?.LogInformation(\"Function {FunctionName} returned {Result}\", targetFunction, invokeResult);","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Runtime.Dapr/Actors/StepActor.cs#L272-L308","documentation":"After AssignStepFunctionParameterValues adds message values to the inputs, HandleMessageAsync computes which functions have all required parameters satisfied (invocableFunctions). It expects the function named in message.FunctionName to be among them. If a different function became invocable instead, this InvalidOperationException is thrown, signalling a mismatch between the edge configuration and the step's actual function signatures.","triggerScenarios":"A message targeting function 'A' delivers parameter values that cause function 'B' to have all inputs satisfied. This means the edge that produced the message references a function name or parameter mapping that does not match the step's [KernelFunction] definitions.","commonSituations":"A step has multiple [KernelFunction] methods and the edge's KernelProcessFunctionTarget.FunctionName is misspelled or refers to a removed function. Parameter names in the function target don't match the actual method parameters, so values accumulate under the wrong function. A process graph was built against an older version of the step class.","solutions":["Verify that the edge's KernelProcessFunctionTarget.FunctionName exactly matches a [KernelFunction] name on the destination step class.","Check that the KernelProcessFunctionTarget.ParameterName matches the actual method parameter name on the [KernelFunction].","Rebuild the process graph if the step class's function signatures have changed (renamed methods, added/removed parameters)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before deploying, validate that edge function names match step [KernelFunction] names:\nvar stepType = typeof(MyStep);\nvar functionNames = stepType.GetMethods()\n    .Where(m => m.GetCustomAttribute<KernelFunctionAttribute>() != null)\n    .Select(m => m.Name)\n    .ToHashSet();\n\nforeach (var edge in processBuilder.Build().Edges)\n{\n    foreach (var e in edge.Value)\n    {\n        if (e.OutputTarget is KernelProcessFunctionTarget ft && !functionNames.Contains(ft.FunctionName))\n        {\n            throw new InvalidOperationException($\"Edge targets function '{ft.FunctionName}' which does not exist on {stepType.Name}.\");\n        }\n    }\n}","typeGuard":"static bool IsValidFunctionName(Type stepType, string functionName)\n{\n    return stepType.GetMethods()\n        .Any(m => m.GetCustomAttribute<KernelFunctionAttribute>() != null && m.Name == functionName);\n}","tryCatchPattern":"try\n{\n    await stepActor.ProcessIncomingMessagesAsync();\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"function names configured correctly\"))\n{\n    logger.LogError(\"Function name mismatch in edge configuration. Verify [KernelFunction] names match edge targets.\");\n}","preventionTips":["Ensure edge KernelProcessFunctionTarget.FunctionName exactly matches [KernelFunction] method names.","Keep KernelProcessFunctionTarget.ParameterName consistent with actual method parameter names.","Rebuild the process graph whenever step function signatures change."],"tags":["dapr","process-runtime","function-routing","edge-configuration","semantic-kernel"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}