microsoft/semantic-kernel · error · KernelException

The specified RequiredFunctions function {metadata.PluginNam

Error message

The specified RequiredFunctions function {metadata.PluginName}-{metadata.Name} is not available in the kernel.

What it means

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.

Source

Thrown at dotnet/src/Connectors/Connectors.MistralAI/MistralAIToolCallBehavior.cs:202

            // Lack of a kernel is fatal: we don't want to tell the model we can handle the functions
            // and then fail to do so, so we fail before we get to that point. This is an error
            // on the consumers behalf: if they specify auto-invocation with any functions, they must
            // specify the kernel and the kernel must contain those functions.
            bool autoInvoke = base.MaximumAutoInvokeAttempts > 0;
            if (autoInvoke && kernel is null)
            {
                throw new KernelException($"Auto-invocation with {nameof(AnyFunction)} is not supported when no kernel is provided.");
            }

            foreach (var metadata in this._kernelFunctionMetadata)
            {
                // Make sure that if auto-invocation is specified, every enabled function can be found in the kernel.
                if (autoInvoke)
                {
                    Debug.Assert(kernel is not null);
                    if (!kernel!.Plugins.TryGetFunction(metadata.PluginName, metadata.Name, out _))
                    {
                        throw new KernelException($"The specified {nameof(RequiredFunctions)} function {metadata.PluginName}-{metadata.Name} is not available in the kernel.");
                    }
                }
            }

            request.ToolChoice = "any";

            foreach (var functionMetadata in this._kernelFunctionMetadata)
            {
                request.AddTool(ToMistralTool(functionMetadata));
            }
        }

        /// <summary>Gets how many requests are part of a single interaction should include this tool in the request.</summary>
        /// <remarks>
        /// Unlike <see cref="KernelFunctions"/>, this must use 1 as the maximum
        /// use attempts. Otherwise, every call back to the model _requires_ it to invoke the function (as opposed
        /// to allows it), which means we end up doing the same work over and over and over until the maximum is reached.
        /// Thus for "requires", we must send the tool information only once.

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Verify the function identifier string matches exactly: 'PluginName-FunctionName' as registered in Kernel.Plugins.
  2. Ensure all referenced plugins are added to the kernel via kernel.Plugins.AddFrom... before calling the service.
  3. Check for typos or casing mismatches in the function name passed to RequiredFunctions.

Example fix

// before
var kernel = new Kernel();
// plugin 'TimePlugin' not added
var behavior = MistralAIToolCallBehavior.RequiredFunctions("TimePlugin-Now");

// after
var builder = Kernel.CreateBuilder();
builder.Plugins.AddFromType<TimePlugin>("TimePlugin");
var kernel = builder.Build();
var behavior = MistralAIToolCallBehavior.RequiredFunctions("TimePlugin-Now");
Defensive patterns

Strategy: validation

Validate before calling

foreach (var id in requiredFunctionIds)
{
    var parts = id.Split('-', 2);
    if (!kernel.Plugins.TryGetFunction(parts[0], parts[1], out _))
        throw new InvalidOperationException($"Function {id} not found in kernel.");
}

Type guard

static bool AllFunctionsInKernel(Kernel kernel, IEnumerable<string> ids) =>
    ids.All(id =>
    {
        var parts = id.Split('-', 2);
        return kernel.Plugins.TryGetFunction(parts[0], parts[1], out _);
    });

Prevention

When it happens

Trigger: Creating MistralAIToolCallBehavior.RequiredFunctions with function IDs like 'MyPlugin-DoThing', but the kernel's Plugins collection does not contain that plugin or that function name.

Common situations: 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.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/fc87265e8daace13. Report an issue: GitHub.