microsoft/semantic-kernel · error · KernelException

The step has not been initialized.

Error message

The step has not been initialized.

What it means

Thrown by LocalProxy.AssignStepFunctionParameterValues when the internal fields _functions, _inputs, or _initialInputs are null. These fields are populated during InitializeStepAsync (the lazy initialization task). This error indicates that a message was assigned to the proxy step's function parameters before initialization completed or after the step was deinitialized.

Source

Thrown at dotnet/src/Experimental/Process.LocalRuntime/LocalProxy.cs:37

    private bool _isInitialized = false;

    /// <summary>
    /// Initializes a new instance of the <see cref="LocalMap"/> class.
    /// </summary>
    /// <param name="proxy">an instance of <see cref="KernelProcessProxy"/></param>
    /// <param name="kernel">An instance of <see cref="Kernel"/></param>
    internal LocalProxy(KernelProcessProxy proxy, Kernel kernel)
        : base(proxy, kernel)
    {
        this._proxy = proxy;
        this._logger = this._kernel.LoggerFactory?.CreateLogger(this._proxy.State.Name) ?? new NullLogger<LocalStep>();
    }

    internal override void AssignStepFunctionParameterValues(ProcessMessage message)
    {
        if (this._functions is null || this._inputs is null || this._initialInputs is null)
        {
            throw new KernelException("The step has not been initialized.").Log(this._logger);
        }

        if (message.Values.Count != 1)
        {
            throw new KernelException("The proxy step can only handle 1 parameter object").Log(this._logger);
        }

        var kvp = message.Values.Single();

        if (this._inputs.TryGetValue(message.FunctionName, out Dictionary<string, object?>? functionName) && functionName != null && functionName.TryGetValue(kvp.Key, out object? parameterName) && parameterName != null)
        {
            this._logger.LogWarning("Step {StepName} already has input for {FunctionName}.{Key}, it is being overwritten with a message from Step named '{SourceId}'.", this.Name, message.FunctionName, kvp.Key, message.SourceId);
        }

        if (!this._inputs.TryGetValue(message.FunctionName, out Dictionary<string, object?>? functionParameters))
        {
            this._inputs[message.FunctionName] = [];
            functionParameters = this._inputs[message.FunctionName];

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Ensure HandleMessageAsync is the entry point (it awaits _initializeTask.Value before delegating), rather than calling AssignStepFunctionParameterValues directly.
  2. Verify the proxy step is fully initialized before any message routing occurs by calling StartAsync which triggers the process-level initialization chain.
  3. If the step was deinitialized, do not reuse it; create a fresh process context instead.
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: AssignStepFunctionParameterValues is called on a LocalProxy before its _initializeTask.Value has been awaited, or after DeinitializeStepAsync has cleared the internal state. The proxy step requires its plugin functions and input channels to be loaded first.

Common situations: Messages reaching the proxy step before the lazy initialization completes due to a race or incorrect ordering; calling AssignStepFunctionParameterValues directly instead of through HandleMessageAsync (which awaits initialization first); using a proxy step after deinitialization.

Related errors


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