{"record":{"id":"c797461e75382167","repo":"microsoft/semantic-kernel","slug":"the-target-step-has-more-than-one-function-so-a-f","errorCode":null,"errorMessage":"The target step has more than one function, so a function name must be provided.","messagePattern":"The target 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":183,"sourceCode":"    /// <param name=\"parameterName\">The name of the parameter. May be null if only one parameter exists on the function.</param>\n    /// <returns>A valid instance of <see cref=\"KernelProcessFunctionTarget\"/> for this step.</returns>\n    /// <exception cref=\"InvalidOperationException\"></exception>\n    internal virtual KernelProcessFunctionTarget ResolveFunctionTarget(string? functionName, string? parameterName)\n    {\n        string? verifiedFunctionName = functionName;\n        string? verifiedParameterName = parameterName;\n\n        if (this.FunctionsDict.Count == 0)\n        {\n            throw new KernelException($\"The target step {this.Name} has no functions.\");\n        }\n\n        // If the function name is null or whitespace, then there can only one function on the step\n        if (string.IsNullOrWhiteSpace(verifiedFunctionName))\n        {\n            if (this.FunctionsDict.Count > 1)\n            {\n                throw new KernelException(\"The target step has more than one function, so a function name must be provided.\");\n            }\n\n            verifiedFunctionName = this.FunctionsDict.Keys.First();\n        }\n\n        // Verify that the target function exists\n        if (!this.FunctionsDict.TryGetValue(verifiedFunctionName!, out var kernelFunctionMetadata) || kernelFunctionMetadata is null)\n        {\n            throw new KernelException($\"The function {functionName} does not exist on step {this.Name}\");\n        }\n\n        // If the parameter name is null or whitespace, then the function must have 0 or 1 parameters\n        if (string.IsNullOrWhiteSpace(verifiedParameterName))\n        {\n            var undeterminedParameters = kernelFunctionMetadata.Parameters.Where(p => p.ParameterType != typeof(KernelProcessStepContext)).ToList();\n\n            if (undeterminedParameters.Count > 1)\n            {","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/ProcessStepBuilder.cs#L165-L201","documentation":"Thrown by ProcessStepBuilder.ResolveFunctionTarget when functionName is null or whitespace, the step has more than one function, and no function name was supplied to disambiguate. This is the target-side counterpart of error 475, triggered during incoming edge target resolution.","triggerScenarios":"Creating a ProcessFunctionTargetBuilder for a step with multiple kernel functions without specifying functionName. E.g. edge.SendEventTo(step.AsFunctionTarget()) where step has several [KernelFunction] methods.","commonSituations":"Using shorthand targeting APIs that omit the function name on multi-function steps; adding a second function to a previously single-function step and not updating edge definitions; dynamic process construction that doesn't track function names.","solutions":["Provide the functionName explicitly when creating the target for a multi-function step.","Use step.OnFunction(\"FunctionName\") to specify which function receives the event.","If ambiguity is unintended, review whether the step truly needs multiple kernel functions."],"exampleFix":"// before\nvar target = new ProcessFunctionTargetBuilder(multiFunctionStep); // no functionName\n// throws if step has >1 function\n\n// after\nvar target = new ProcessFunctionTargetBuilder(multiFunctionStep, functionName: \"ProcessData\");","handlingStrategy":"validation","validationCode":"if (targetStep.FunctionsDict.Count > 1 && string.IsNullOrWhiteSpace(functionName))\n    throw new InvalidOperationException(\n        $\"Target step '{targetStep.Name}' has multiple functions. Provide functionName.\");\n\nvar target = new ProcessFunctionTargetBuilder(targetStep, functionName: functionName);","typeGuard":"bool TargetNeedsExplicitFunctionName(ProcessStepBuilder step) => step.FunctionsDict.Count > 1;","tryCatchPattern":null,"preventionTips":["Provide functionName explicitly when the target step has multiple kernel functions.","Use OnFunction or the ProcessFunctionTargetBuilder constructor with a functionName argument.","When adding a second function to a step, audit all incoming edge definitions for missing function names."],"tags":["step-builder","function-target","ambiguity","dotnet"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}