{"record":{"id":"cc39adb15a0d16ba","repo":"microsoft/semantic-kernel","slug":"multiple-targets-found-for-the-specified-function","errorCode":null,"errorMessage":"Multiple targets found for the specified function and parameter '{functionName}.{parameterName}'.","messagePattern":"Multiple targets found for the specified function and parameter '(.+?)\\.(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/ProcessBuilder.cs","lineNumber":102,"sourceCode":"        {\n            try\n            {\n                targets.Add(step.ResolveFunctionTarget(functionName, parameterName));\n            }\n            catch (KernelException)\n            {\n                // If the function is not found on the source step, then we can ignore it.\n            }\n        }\n\n        // If no targets were found or if multiple targets were found, throw an exception.\n        if (targets.Count == 0)\n        {\n            throw new InvalidOperationException($\"No targets found for the specified function and parameter '{functionName}.{parameterName}'.\");\n        }\n        else if (targets.Count > 1)\n        {\n            throw new InvalidOperationException($\"Multiple targets found for the specified function and parameter '{functionName}.{parameterName}'.\");\n        }\n\n        return targets[0];\n    }\n\n    /// <inheritdoc/>\n    internal override void LinkTo(string eventId, ProcessStepEdgeBuilder edgeBuilder)\n    {\n        Verify.NotNull(edgeBuilder?.Source, nameof(edgeBuilder.Source));\n        Verify.NotNull(edgeBuilder?.Target, nameof(edgeBuilder.Target));\n\n        // Keep track of the entry point steps\n        this._entrySteps.Add(edgeBuilder.Source);\n        this._externalEventTargetMap[eventId] = edgeBuilder.Target;\n        base.LinkTo(eventId, edgeBuilder);\n    }\n\n    /// <inheritdoc/>","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/ProcessBuilder.cs#L84-L120","documentation":"Thrown by ProcessBuilder.ResolveFunctionTarget when more than one entry-point step resolves the same functionName.parameterName combination, creating an ambiguous target. The method collects all successful resolutions across entry steps; if more than one matches, it cannot determine which to use.","triggerScenarios":"Multiple entry-point steps in the process each expose a KernelFunction with the same name (and matching parameter), and ResolveFunctionTarget is called with that function/parameter pair. The process cannot disambiguate which entry step to route to.","commonSituations":"A sub-process with two or more entry steps that each define a KernelFunction named the same (e.g., multiple steps with 'Execute'). Using auto-inference (null functionName) when there are multiple entry steps each with a single function. Linking edges to a process that has identically-named functions across different steps.","solutions":["Provide an explicit functionName (and parameterName) that is unique across all entry-point steps.","Rename [KernelFunction] attributes on entry steps so each function name is unique within the process.","Reduce to a single entry-point step that exposes the target function, or split the process so each entry point has distinct function names."],"exampleFix":"// before — two entry steps both named 'Execute'\n// stepA.Execute and stepB.Execute both exist → ambiguous\nprocess.ResolveFunctionTarget(\"Execute\", null); // throws\n\n// after — rename one function\n// stepA has [KernelFunction(\"ExecuteA\")], stepB has [KernelFunction(\"ExecuteB\")]\nprocess.ResolveFunctionTarget(\"ExecuteA\", null);","handlingStrategy":"validation","validationCode":"// Check for function name collisions across entry-point steps.\npublic List<string> FindFunctionCollisions(ProcessBuilder process)\n{\n    var allFunctions = process.Steps\n        .SelectMany(s => s.GetFunctionMetadataMap().Keys)\n        .GroupBy(k => k)\n        .Where(g => g.Count() > 1)\n        .Select(g => g.Key)\n        .ToList();\n    return allFunctions;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give each [KernelFunction] on entry-point steps a unique name within the process.","Provide explicit functionName when resolving targets instead of relying on auto-inference.","Audit function names across entry steps during process construction."],"tags":["semantic-kernel","process-framework","function-target","edge","ambiguous","validation"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}