microsoft/semantic-kernel · error · KernelException
Type '{this.InnerStepDotnetType}' is not a valid KernelProce
Error message
Type '{this.InnerStepDotnetType}' is not a valid KernelProcessStep type. What it means
Thrown when the resolved inner step type does not implement KernelProcessStep. After successfully loading the Type from its assembly-qualified name, the runtime verifies it is assignable to KernelProcessStep; a type that fails this check is not a valid process step.
Source
Thrown at dotnet/src/Experimental/Process.Runtime.Dapr/DaprStepInfo.cs:55
/// </summary>
public required Dictionary<string, List<KernelProcessEdge>> Edges { get; init; }
/// <summary>
/// Builds an instance of <see cref="KernelProcessStepInfo"/> from the current object.
/// </summary>
/// <returns>An instance of <see cref="KernelProcessStepInfo"/></returns>
/// <exception cref="KernelException"></exception>
public KernelProcessStepInfo ToKernelProcessStepInfo()
{
Type? innerStepType = Type.GetType(this.InnerStepDotnetType);
if (innerStepType is null)
{
throw new KernelException($"Unable to create inner step type from assembly qualified name `{this.InnerStepDotnetType}`");
}
if (!typeof(KernelProcessStep).IsAssignableFrom(innerStepType))
{
throw new KernelException($"Type '{this.InnerStepDotnetType}' is not a valid KernelProcessStep type.");
}
return new KernelProcessStepInfo(innerStepType, this.State, this.Edges);
}
/// <summary>
/// Initializes a new instance of the <see cref="DaprStepInfo"/> class from an instance of <see cref="KernelProcessStepInfo"/>.
/// </summary>
/// <returns>An instance of <see cref="DaprStepInfo"/></returns>
public static DaprStepInfo FromKernelStepInfo(KernelProcessStepInfo kernelStepInfo)
{
Verify.NotNull(kernelStepInfo, nameof(kernelStepInfo));
return new DaprStepInfo
{
InnerStepDotnetType = kernelStepInfo.InnerStepType.AssemblyQualifiedName!,
State = kernelStepInfo.State,
Edges = kernelStepInfo.Edges.ToDictionary(kvp => kvp.Key, kvp => new List<KernelProcessEdge>(kvp.Value)),View on GitHub (pinned to c028a0c7dc)
Solutions
- Confirm the persisted type actually implements KernelProcessStep (directly or via a step base class).
- Correct the InnerStepDotnetType in the process definition to point at a real KernelProcessStep subclass.
- If the type was refactored, update the process definition and re-persist it.
Example fix
// before
public class MyWorker { } // not a step
// after
public class MyWorker : KernelProcessStep
{
[KernelProcessStepProcessFunction]
public ValueTask DoWorkAsync(ProcessMessage msg) => ValueTask.CompletedTask;
} Defensive patterns
Strategy: validation
Validate before calling
var t = Type.GetType(step.InnerStepDotnetType);
if (t is null || !typeof(KernelProcessStep).IsAssignableFrom(t))
throw new InvalidOperationException($"Type '{step.InnerStepDotnetType}' is not a valid KernelProcessStep."); Type guard
public static bool IsValidStepType(string assemblyQualifiedTypeName)
{
var t = Type.GetType(assemblyQualifiedTypeName);
return t is not null && typeof(KernelProcessStep).IsAssignableFrom(t);
} Try / catch
try
{
var info = daprStepInfo.ToKernelProcessStepInfo();
}
catch (KernelException ex) when (ex.Message.Contains("not a valid KernelProcessStep type"))
{
_logger.LogError(ex, "Persisted type is not a KernelProcessStep; check definition.");
throw;
} Prevention
- Only register KernelProcessStep subclasses as step types.
- Add a unit test asserting each step type implements KernelProcessStep.
- Validate step types at process-definition build time.
When it happens
Trigger: DaprStepInfo.ToKernelProcessStepInfo() checks `typeof(KernelProcessStep).IsAssignableFrom(innerStepType)` and throws when the type is some other class that happens to share the persisted type name or was mistakenly registered as a step.
Common situations: The persisted InnerStepDotnetType was changed to point at a non-step class, the assembly-qualified name collided with a different type after a refactor, or a generic/utility class was accidentally used as a step type.
Related errors
- Type '{stepInfo.InnerStepDotnetType}' is not a valid KernelP
- Type '{stepStateType.Value}' is not a valid KernelProcessSte
- The Process must be initialized before accessing the Name pr
- Internal Process Error: The target event id must be specifie
- The target for the edge is not a function target.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/1df608c62feb5ab0.
Report an issue: GitHub.