{"record":{"id":"f3d6d57bd26b7f65","repo":"microsoft/semantic-kernel","slug":"the-function-functionname-does-not-exist-on-step","errorCode":null,"errorMessage":"The function {functionName} does not exist on step {this.Name}","messagePattern":"The function (.+?) does not exist on step (.+?)","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/ProcessStepBuilder.cs","lineNumber":192,"sourceCode":"        {\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            {\n                // TODO: Uncomment the following line if we want to enforce parameter specification.\n                //throw new KernelException($\"The function {functionName} on step {this.Name} has more than one parameter, so a parameter name must be provided.\");\n            }\n\n            // We can infer the parameter name from the function metadata\n            if (undeterminedParameters.Count == 1)\n            {\n                parameterName = undeterminedParameters[0].Name;\n                verifiedParameterName = parameterName;","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/ProcessStepBuilder.cs#L174-L210","documentation":"Thrown by ProcessStepBuilder.ResolveFunctionTarget when the explicitly provided functionName (after whitespace resolution) is not found in the step's FunctionsDict. The named function does not exist as a [KernelFunction] on the target step.","triggerScenarios":"Specifying a functionName in an edge target that doesn't match any [KernelFunction] method name on the step. The verifiedFunctionName lookup in FunctionsDict fails.","commonSituations":"Typo in the function name string; renaming a kernel function method without updating all edge definitions; case mismatch in function names; referencing a function from a different step type; version mismatch where a function was removed.","solutions":["Verify the functionName exactly matches a [KernelFunction] method name (or its explicit name parameter) on the step type.","Check for typos and case sensitivity — function names are case-sensitive.","Inspect the step's FunctionsDict keys (from GetFunctionMetadataMap) to list valid function names."],"exampleFix":"// before — function name typo\nvar target = new ProcessFunctionTargetBuilder(myStep, functionName: \"ProcesData\");\n// throws — actual function is \"ProcessData\"\n\n// after\nvar target = new ProcessFunctionTargetBuilder(myStep, functionName: \"ProcessData\");","handlingStrategy":"validation","validationCode":"if (!step.FunctionsDict.TryGetValue(functionName, out var metadata) || metadata is null)\n    throw new InvalidOperationException(\n        $\"Function '{functionName}' not found on step '{step.Name}'. \" +\n        $\"Available: {string.Join(\", \", step.FunctionsDict.Keys)}\");\n\nvar target = new ProcessFunctionTargetBuilder(step, functionName: functionName);","typeGuard":"bool FunctionExistsOnStep(ProcessStepBuilder step, string functionName)\n    => step.FunctionsDict.ContainsKey(functionName);","tryCatchPattern":null,"preventionTips":["Verify function names against FunctionsDict keys before creating targets.","Use constants for function names to avoid typos and case mismatches.","Run a pre-build validation pass that checks all referenced function names exist on their steps."],"tags":["step-builder","function-target","name-mismatch","dotnet"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}