{"record":{"id":"d33009d29c37b718","repo":"microsoft/semantic-kernel","slug":"failed-to-resolve-function-target-for-step-gettyp","errorCode":null,"errorMessage":"Failed to resolve function target for {step.GetType().Name}, {step.Name}: Function - {functionName ?? \"any\"} / Parameter - {parameterName ?? \"any\"}","messagePattern":"Failed to resolve function target for (.+?), (.+?): Function - (.+?) / Parameter - (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/ProcessFunctionTargetBuilder.cs","lineNumber":172,"sourceCode":"    public ProcessFunctionTargetBuilder(ProcessStepBuilder step, string? functionName = null, string? parameterName = null) : base(ProcessTargetType.KernelFunction)\n    {\n        Verify.NotNull(step, nameof(step));\n\n        this.Step = step;\n\n        // If the step is an EndStep, we don't need to resolve the function target.\n        if (step is EndStep)\n        {\n            this.FunctionName = \"END\";\n            this.ParameterName = null;\n            return;\n        }\n\n        // Make sure the function target is valid.\n        var target = step.ResolveFunctionTarget(functionName, parameterName);\n        if (target == null)\n        {\n            throw new InvalidOperationException($\"Failed to resolve function target for {step.GetType().Name}, {step.Name}: Function - {functionName ?? \"any\"} / Parameter - {parameterName ?? \"any\"}\");\n        }\n\n        this.FunctionName = target.FunctionName!;\n        this.ParameterName = target.ParameterName;\n    }\n\n    /// <summary>\n    /// Builds the function target.\n    /// </summary>\n    /// <returns>An instance of <see cref=\"KernelProcessFunctionTarget\"/></returns>\n    internal override KernelProcessTarget Build(ProcessBuilder? processBuilder = null)\n    {\n        Verify.NotNull(this.Step.Id);\n        return new KernelProcessFunctionTarget(this.Step.Id, this.FunctionName, this.ParameterName, this.TargetEventId);\n    }\n\n    /// <summary>\n    /// An instance of <see cref=\"ProcessStepBuilder\"/> representing the target Step.","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/ProcessFunctionTargetBuilder.cs#L154-L190","documentation":"Thrown by the ProcessFunctionTargetBuilder constructor when step.ResolveFunctionTarget(functionName, parameterName) returns null, meaning no matching kernel function (and optionally parameter) could be found on the step for the given names. The exception message includes the step type, step name, and the function/parameter names that were attempted.","triggerScenarios":"Creating a ProcessFunctionTargetBuilder with a functionName that does not exist on the step; specifying a functionName for a step whose KernelProcessStep subclass has no [KernelFunction] methods with that name; providing a parameterName that doesn't match any parameter on the function.","commonSituations":"Typo in the function or parameter name; renaming a [KernelFunction] method without updating process edge definitions; the step type was not loaded or decorated with the expected KernelFunction attributes; version mismatch where a function was removed or renamed in a newer step type.","solutions":["Verify the functionName matches a method decorated with [KernelFunction] on the step type.","If functionName is null/omitted, ensure the step has exactly one kernel function so it can be auto-resolved.","Check for typos or case mismatches in function and parameter names (they are case-sensitive).","Inspect the step's GetFunctionMetadataMap() output to list available function names."],"exampleFix":"// before — function name doesn't exist on step\nvar target = new ProcessFunctionTargetBuilder(myStep, functionName: \"ProcessData\");\n// throws if step has [KernelFunction] named \"HandleData\" instead\n\n// after\nvar target = new ProcessFunctionTargetBuilder(myStep, functionName: \"HandleData\");","handlingStrategy":"validation","validationCode":"var functionNames = myStep.GetFunctionMetadataMap().Keys;\nif (!functionNames.Contains(functionName))\n    throw new InvalidOperationException(\n        $\"Function '{functionName}' not found on step '{myStep.Name}'. Available: {string.Join(\", \", functionNames)}\");\n\nvar target = new ProcessFunctionTargetBuilder(myStep, functionName: functionName, parameterName: parameterName);","typeGuard":"bool IsValidFunctionTarget(ProcessStepBuilder step, string? functionName, string? parameterName)\n    => step.ResolveFunctionTarget(functionName, parameterName) is not null;","tryCatchPattern":null,"preventionTips":["Verify function names exist via GetFunctionMetadataMap before constructing a ProcessFunctionTargetBuilder.","Keep function names as constants to avoid typos.","When renaming [KernelFunction] methods, update all process edge definitions in the same change."],"tags":["function-target","kernel-function","metadata-resolution","dotnet"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}