microsoft/semantic-kernel · error · KernelException

The step has not been initialized.

Error message

The step has not been initialized.

What it means

ProxyActor.AssignStepFunctionParameterValues overrides the base method and checks that _functions, _inputs, and _initialInputs are all non-null before proceeding. These fields are populated during ActivateStepAsync (lazy-initialized via _activateTask). If the proxy step has not completed activation, the check fails with a KernelException.

Solutions

  1. Ensure the Kernel instance injected into the ProxyActor has the necessary service registrations for activating KernelProxyStep (ActivatorUtilities.CreateInstance must succeed).
  2. Verify that InitializeStepAsync was called and that _stepInfo is set so ActivateStepAsync can proceed without throwing.
  3. If calling AssignStepFunctionParameterValues directly in a test, first await _activateTask.Value (or call a public method that triggers it) to ensure initialization.
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure InitializeStepAsync and activation succeed before sending messages:
await proxyActor.InitializeProxyAsync(proxyInfo, parentProcessId);
// Trigger activation by calling a method that awaits _activateTask, then check for exceptions:
try { await proxyStep.PrepareIncomingMessagesAsync(); }
catch (Exception ex) { logger.LogError(ex, "Proxy step activation failed."); }

Try / catch

try
{
    await proxyStep.ProcessIncomingMessagesAsync();
}
catch (KernelException ex) when (ex.Message.Contains("step has not been initialized"))
{
    logger.LogError("Proxy step activation failed. Check Kernel DI registrations and InitializeProxyAsync call.");
}

Prevention

When it happens

Trigger: A ProcessMessage reaches AssignStepFunctionParameterValues before ActivateStepAsync has completed. HandleMessageAsync awaits _activateTask.Value before calling this method, so the throw indicates activation failed silently (Lazy<ValueTask> stored a faulted task), or AssignStepFunctionParameterValues was called from a code path that bypassed the lazy-activation await.

Common situations: Activation threw an exception (e.g. step type load failure, DI resolution failure for the KernelProcessStep instance) that was captured in the Lazy<ValueTask> and not surfaced until this check. Also occurs if a subclass or test harness calls AssignStepFunctionParameterValues directly without first triggering activation.

Related errors


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

Appendix: source

Thrown at dotnet/src/Experimental/Process.Runtime.Dapr/Actors/ProxyActor.cs:36

    internal DaprProxyInfo? _daprProxyInfo;

    /// <summary>
    /// Initializes a new instance of the <see cref="ProxyActor"/> class.
    /// </summary>
    /// <param name="host">The Dapr host actor</param>
    /// <param name="kernel">An instance of <see cref="Kernel"/></param>
    public ProxyActor(ActorHost host, Kernel kernel)
        : base(host, kernel)
    {
        this._logger = this._kernel.LoggerFactory?.CreateLogger(typeof(KernelProxyStep)) ?? new NullLogger<ProxyActor>();
    }

    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);
        }

        // Add the message values to the inputs for the function
        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)