microsoft/semantic-kernel · error · KernelException

The ActivateAsync method for the KernelProcessStep could not

Error message

The ActivateAsync method for the KernelProcessStep could not be found.

What it means

Thrown by LocalStep.InitializeStepAsync when GetMethod cannot locate an ActivateAsync method on the step's inner type that accepts the extracted state type as its sole parameter. KernelProcessStep defines ActivateAsync, but if the step's state type extraction yields a type that doesn't match any declared ActivateAsync overload, reflection fails to find the method.

Source

Thrown at dotnet/src/Experimental/Process.LocalRuntime/LocalStep.cs:312

        {
            this._initialInputs = this.FindInputChannels(this._functions, this._logger, this.ExternalMessageChannel);
        }

        this._inputs = this._initialInputs.ToDictionary(kvp => kvp.Key, kvp => kvp.Value?.ToDictionary(kvp => kvp.Key, kvp => kvp.Value));

        // Activate the step with user-defined state if needed
        Type stateType = this._stepInfo.InnerStepType.ExtractStateType(out Type? userStateType, this._logger);
        KernelProcessStepState stateObject = this._stepInfo.State;
        stateObject.InitializeUserState(stateType, userStateType);

        if (stateObject is null)
        {
            throw new KernelException("The state object for the KernelProcessStep could not be created.").Log(this._logger);
        }

        MethodInfo methodInfo =
            this._stepInfo.InnerStepType.GetMethod(nameof(KernelProcessStep.ActivateAsync), [stateType]) ??
            throw new KernelException("The ActivateAsync method for the KernelProcessStep could not be found.").Log(this._logger);

        this._stepState = stateObject;

        ValueTask activateTask =
            (ValueTask?)methodInfo.Invoke(this._stepInstance, [stateObject]) ??
            throw new KernelException("The ActivateAsync method failed to complete.").Log(this._logger);

        await this._stepInstance.ActivateAsync(stateObject).ConfigureAwait(false);
        await activateTask.ConfigureAwait(false);
    }

    /// <summary>
    /// Deinitializes the step
    /// </summary>
    public virtual Task DeinitializeStepAsync()
    {
        this._logger.LogInformation("Step {Name} has deinitialized", this.Name);
        return Task.CompletedTask;

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Ensure the step class extends KernelProcessStep<TState> and TState matches the state type used in initialization.
  2. If extending non-generic KernelProcessStep, verify ActivateAsync(KernelProcessStepState) is present and accessible.
  3. Check that the state type extraction (ExtractStateType) returns the expected type for your step class.

Example fix

// before - step does not declare the expected ActivateAsync overload
class MyStep : KernelProcessStep {
    // no ActivateAsync override
}
// after - extend generic base which provides the correct signature
class MyStep : KernelProcessStep<MyState> {
    public override ValueTask ActivateAsync(MyState state) { ... }
}
Defensive patterns

Strategy: type-guard

Type guard

// Verify the step type has an accessible ActivateAsync method with the correct state type
var stateType = typeof(MyStep).ExtractStateType(out _, logger);
var method = typeof(MyStep).GetMethod(nameof(KernelProcessStep.ActivateAsync), [stateType]);
if (method is null) { /* step type does not conform to the activation contract */ }

Prevention

When it happens

Trigger: The step's inner type does not declare or inherit an ActivateAsync(TState) method where TState matches the extracted state type. This can happen with custom step types that don't follow the KernelProcessStep<TState> pattern, or when ExtractStateType infers a different type than expected.

Common situations: A step class that extends KernelProcessStep (non-generic) without overriding ActivateAsync; a step class where the generic state parameter type differs from what ExtractStateType resolves; stripping or obfuscating methods during build; step types from incompatible assembly versions.

Related errors


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