{"record":{"id":"b30ac812c3ce0528","repo":"microsoft/semantic-kernel","slug":"the-step-this-name-has-more-than-one-function-s","errorCode":null,"errorMessage":"The step {this.Name} has more than one function, so a function name must be provided.","messagePattern":"The step (.+?) has more than one function, so a function name must be provided\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/ProcessStepBuilder.cs","lineNumber":137,"sourceCode":"\n        // Register the group by GroupId.\n        this.IncomingEdgeGroups[edgeGroup.GroupId] = edgeGroup;\n    }\n\n    /// <summary>\n    /// Resolves the function name for the step.\n    /// </summary>\n    /// <returns></returns>\n    /// <exception cref=\"KernelException\"></exception>\n    private string ResolveFunctionName()\n    {\n        if (this.FunctionsDict.Count == 0)\n        {\n            throw new KernelException($\"The step {this.Name} has no functions.\");\n        }\n        else if (this.FunctionsDict.Count > 1)\n        {\n            throw new KernelException($\"The step {this.Name} has more than one function, so a function name must be provided.\");\n        }\n\n        return this.FunctionsDict.Keys.First();\n    }\n\n    /// <summary>\n    /// Links the output of the current step to the an input of another step via the specified event type.\n    /// </summary>\n    /// <param name=\"eventId\">The Id of the event.</param>\n    /// <param name=\"edgeBuilder\">The targeted function.</param>\n    internal virtual void LinkTo(string eventId, ProcessStepEdgeBuilder edgeBuilder)\n    {\n        if (!this.Edges.TryGetValue(eventId, out List<ProcessStepEdgeBuilder>? edges) || edges == null)\n        {\n            edges = [];\n            this.Edges[eventId] = edges;\n        }\n","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/ProcessStepBuilder.cs#L119-L155","documentation":"Thrown by ProcessStepBuilder.ResolveFunctionName when the step has more than one kernel function but no explicit function name was provided. Auto-resolution only works when there is exactly one function to choose from; with multiple functions, ambiguity must be resolved by the caller.","triggerScenarios":"Calling an API that resolves a function target on a step with multiple [KernelFunction] methods, without specifying which function to target. E.g. edge.SendEventTo(step.AsFunctionTarget()) where step has multiple functions.","commonSituations":"Adding a step with several kernel functions and then using a convenience method that auto-resolves the function; refactoring a single-function step to add a second function without updating edge definitions; using generic targeting APIs that assume single-function steps.","solutions":["Specify the function name explicitly when creating the target: step.OnFunction(\"FunctionName\").SendEventTo(target).","Use WhereInputEventIs or OnFunction with the specific function name to disambiguate.","If only one function should be the target, remove or rename the other [KernelFunction] methods on the step."],"exampleFix":"// before — step has two functions, no name specified\nprocess.OnInputEvent(\"Start\")\n    .SendEventTo(myStep.AsFunctionTarget()); // throws — ambiguous\n\n// after — specify the function name\nprocess.OnInputEvent(\"Start\")\n    .SendEventTo(myStep.OnFunction(\"ProcessData\"));","handlingStrategy":"validation","validationCode":"if (step.FunctionsDict.Count > 1 && string.IsNullOrWhiteSpace(functionName))\n    throw new InvalidOperationException(\n        $\"Step '{step.Name}' has {step.FunctionsDict.Count} functions. Specify a function name.\");\n\n// proceed with resolution","typeGuard":"bool NeedsExplicitFunctionName(ProcessStepBuilder step) => step.FunctionsDict.Count > 1;","tryCatchPattern":null,"preventionTips":["Always specify the function name when targeting a step with multiple kernel functions.","Use step.OnFunction(\"name\") to disambiguate.","Track which steps have multiple functions during design to ensure all edges specify a function name."],"tags":["step-builder","function-resolution","ambiguity","dotnet"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}