microsoft/semantic-kernel · error · KernelException
Could not load type '{assemblyQualifiedTypeName}'.
Error message
Could not load type '{assemblyQualifiedTypeName}'. What it means
Thrown by TypeInfo.ConvertValue when Type.GetType cannot resolve the provided assembly-qualified type name to a .NET Type. The JsonElement value cannot be deserialized without knowing its target type.
Source
Thrown at dotnet/src/Experimental/Process.Runtime.Dapr/Serialization/TypeInfo.cs:44
/// Restore the object's type from the provided assembly qualified type-name, but
/// only if it is a <see cref="JsonElement"/>. Otherwise, return the original value.
/// </summary>
public static object? ConvertValue(string? assemblyQualifiedTypeName, object? value)
{
if (value == null || value.GetType() != typeof(JsonElement))
{
return value;
}
if (assemblyQualifiedTypeName == null)
{
throw new KernelException("Data persisted without type information.");
}
Type? valueType = Type.GetType(assemblyQualifiedTypeName);
if (valueType is null)
{
throw new KernelException($"Could not load type '{assemblyQualifiedTypeName}'.");
}
return ((JsonElement)value).Deserialize(valueType);
}
}
View on GitHub (pinned to c028a0c7dc)
Solutions
- Deploy the assembly containing the persisted value's type to the Dapr actor host.
- Verify the assembly-qualified name is complete and correct (assembly, version, PublicKeyToken).
- If the type moved, add TypeForwardedFrom or load the appropriate AssemblyLoadContext.
- Disable aggressive trimming/AOT for assemblies holding persisted value types.
Defensive patterns
Strategy: validation
Validate before calling
var valueType = Type.GetType(assemblyQualifiedTypeName);
if (valueType is null)
throw new InvalidOperationException($"Type '{assemblyQualifiedTypeName}' is not loadable; deploy its assembly."); Type guard
public static bool IsTypeLoadable(string assemblyQualifiedTypeName) =>
Type.GetType(assemblyQualifiedTypeName) is not null; Try / catch
try
{
var restored = TypeInfo.ConvertValue(typeName, value);
}
catch (KernelException ex) when (ex.Message.Contains("Could not load type"))
{
_logger.LogError(ex, "Persisted value type assembly is missing from the host.");
throw;
} Prevention
- Deploy assemblies for all persisted value types to the actor host.
- Store complete assembly-qualified type names.
- Avoid renaming/moving persisted types; use TypeForwardedFrom when refactoring.
When it happens
Trigger: ConvertValue resolves Type.GetType(assemblyQualifiedTypeName); a null result means the type (or its assembly) is not available to the current runtime.
Common situations: The type's assembly is not loaded by the actor host, the assembly-qualified name is malformed or truncated, the type was renamed/removed in a newer version, or trimming removed the type metadata.
Related errors
- Could not load the inner step type '{stepInfo.InnerStepDotne
- Unable to create inner step type from assembly qualified nam
- Type '{stepStateType.Value}' could not be resolved to a vali
- Unable to deserialize KernelProcessEvent queue.
- Unable to deserialize ProcessEvent queue.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/a539e865f3a4108a.
Report an issue: GitHub.