{"record":{"id":"fc87265e8daace13","repo":"microsoft/semantic-kernel","slug":"the-specified-requiredfunctions-function-metadata","errorCode":null,"errorMessage":"The specified RequiredFunctions function {metadata.PluginName}-{metadata.Name} is not available in the kernel.","messagePattern":"The specified RequiredFunctions function (.+?)-(.+?) is not available in the kernel\\.","errorType":"exception","errorClass":"KernelException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Connectors/Connectors.MistralAI/MistralAIToolCallBehavior.cs","lineNumber":202,"sourceCode":"            // Lack of a kernel is fatal: we don't want to tell the model we can handle the functions\n            // and then fail to do so, so we fail before we get to that point. This is an error\n            // on the consumers behalf: if they specify auto-invocation with any functions, they must\n            // specify the kernel and the kernel must contain those functions.\n            bool autoInvoke = base.MaximumAutoInvokeAttempts > 0;\n            if (autoInvoke && kernel is null)\n            {\n                throw new KernelException($\"Auto-invocation with {nameof(AnyFunction)} is not supported when no kernel is provided.\");\n            }\n\n            foreach (var metadata in this._kernelFunctionMetadata)\n            {\n                // Make sure that if auto-invocation is specified, every enabled function can be found in the kernel.\n                if (autoInvoke)\n                {\n                    Debug.Assert(kernel is not null);\n                    if (!kernel!.Plugins.TryGetFunction(metadata.PluginName, metadata.Name, out _))\n                    {\n                        throw new KernelException($\"The specified {nameof(RequiredFunctions)} function {metadata.PluginName}-{metadata.Name} is not available in the kernel.\");\n                    }\n                }\n            }\n\n            request.ToolChoice = \"any\";\n\n            foreach (var functionMetadata in this._kernelFunctionMetadata)\n            {\n                request.AddTool(ToMistralTool(functionMetadata));\n            }\n        }\n\n        /// <summary>Gets how many requests are part of a single interaction should include this tool in the request.</summary>\n        /// <remarks>\n        /// Unlike <see cref=\"KernelFunctions\"/>, this must use 1 as the maximum\n        /// use attempts. Otherwise, every call back to the model _requires_ it to invoke the function (as opposed\n        /// to allows it), which means we end up doing the same work over and over and over until the maximum is reached.\n        /// Thus for \"requires\", we must send the tool information only once.","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Connectors/Connectors.MistralAI/MistralAIToolCallBehavior.cs#L184-L220","documentation":"Thrown as a KernelException when a RequiredFunctions behavior with auto-invocation enabled cannot find a specified function (PluginName-FunctionName) in the kernel's plugin collection. The connector verifies every required function is present in the kernel so it can auto-invoke it; a missing function is a configuration mismatch.","triggerScenarios":"Creating MistralAIToolCallBehavior.RequiredFunctions with function IDs like 'MyPlugin-DoThing', but the kernel's Plugins collection does not contain that plugin or that function name.","commonSituations":"Function renamed during a refactor but the behavior string was not updated; plugin not registered in the kernel before the completion call; typo in the plugin-function identifier; plugin loaded conditionally and skipped.","solutions":["Verify the function identifier string matches exactly: 'PluginName-FunctionName' as registered in Kernel.Plugins.","Ensure all referenced plugins are added to the kernel via kernel.Plugins.AddFrom... before calling the service.","Check for typos or casing mismatches in the function name passed to RequiredFunctions."],"exampleFix":"// before\nvar kernel = new Kernel();\n// plugin 'TimePlugin' not added\nvar behavior = MistralAIToolCallBehavior.RequiredFunctions(\"TimePlugin-Now\");\n\n// after\nvar builder = Kernel.CreateBuilder();\nbuilder.Plugins.AddFromType<TimePlugin>(\"TimePlugin\");\nvar kernel = builder.Build();\nvar behavior = MistralAIToolCallBehavior.RequiredFunctions(\"TimePlugin-Now\");","handlingStrategy":"validation","validationCode":"foreach (var id in requiredFunctionIds)\n{\n    var parts = id.Split('-', 2);\n    if (!kernel.Plugins.TryGetFunction(parts[0], parts[1], out _))\n        throw new InvalidOperationException($\"Function {id} not found in kernel.\");\n}","typeGuard":"static bool AllFunctionsInKernel(Kernel kernel, IEnumerable<string> ids) =>\n    ids.All(id =>\n    {\n        var parts = id.Split('-', 2);\n        return kernel.Plugins.TryGetFunction(parts[0], parts[1], out _);\n    });","tryCatchPattern":null,"preventionTips":["Register all referenced plugins before constructing RequiredFunctions.","Keep function identifiers in a constants file to avoid typos.","Add integration tests that verify kernel.Plugins contains all required functions."],"tags":["mistralai","tool-calling","required-functions","plugin-registration","kernel-exception"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}