microsoft/aspire · error
Error converting resource
Error message
Error converting resource "{Name}" to ResourceViewModel. What it means
This error wraps any exception thrown while converting a gRPC Resource protobuf message into a dashboard ResourceViewModel. The real cause is available as the InnerException; the outer message only tells you which resource failed. It exists so the dashboard can attribute conversion failures to a specific named resource.
Solutions
- Inspect the InnerException stack trace to find the exact failing property
- Ensure dashboard and AppHost/CLI/SDK versions match (upgrade both together)
- Restart the AppHost so the dashboard receives a clean resource snapshot
- Report the inner exception to Aspire if it occurs with matched versions
Example fix
// before: opaque failure
var vm = resource.ToViewModel();
// after: log the inner cause
try
{
var vm = resource.ToViewModel();
}
catch (InvalidOperationException ex)
{
logger.LogError(ex.InnerException, "Failed to convert resource {Name}", resource.Name);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (resource is null || string.IsNullOrEmpty(resource.Name))
{
throw new ArgumentException("Resource and Name must be populated before conversion");
} Try / catch
try { var vm = resource.ToViewModel(); }
catch (InvalidOperationException ex)
{
logger.LogError(ex.InnerException, "Conversion failed for resource {Name}", resource.Name);
} Prevention
- Keep dashboard and AppHost/SDK versions matched
- Inspect InnerException for the real cause before retrying
- Report persistent inner failures to Aspire with the resource payload
When it happens
Trigger: Any property access or mapping inside the ToViewModel conversion throws — e.g. malformed resource data from the server, unexpected enum values for icons/variants, or null/invalid fields in the Resource snapshot sent by the AppHost.
Common situations: A newer AppHost sends resource data the dashboard version does not understand (version skew), a resource reports unusual metadata (unknown icon name/variant), or corrupted/partial protobuf state arrives during a dashboard session.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- File ' ' exceeded the expected size of bytes.
- InvalidArgument
- ResourceExhausted
- AppHost:ResourceService:ApiKey is not specified in…
- [aspire-terminal] WS closed abnormally
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/da281ff2bfae666d.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Dashboard/ServiceClient/Partials.cs:53
Properties = CreatePropertyViewModels(resourceType, Properties, knownPropertyLookup, logger),
Environment = GetEnvironment(),
Urls = GetUrls(),
Volumes = GetVolumes(),
Relationships = GetRelationships(),
State = HasState ? State : null,
KnownState = HasState ? Enum.TryParse(State, out KnownResourceState knownState) ? knownState : null : null,
StateStyle = HasStateStyle ? StateStyle : null,
Commands = GetCommands(),
HealthReports = HealthReports.Select(ToHealthReportViewModel).OrderBy(vm => vm.Name).ToImmutableArray(),
IsHidden = IsHidden,
SupportsDetailedTelemetry = SupportsDetailedTelemetry,
IconName = HasIconName ? IconName : null,
IconVariant = HasIconVariant ? MapResourceIconVariant(IconVariant) : null
};
}
catch (Exception ex)
{
throw new InvalidOperationException($@"Error converting resource ""{Name}"" to {nameof(ResourceViewModel)}.", ex);
}
HealthReportViewModel ToHealthReportViewModel(HealthReport healthReport)
{
return new HealthReportViewModel(
healthReport.Key,
healthReport.HasStatus ? MapHealthStatus(healthReport.Status) : null,
healthReport.Description,
healthReport.Exception)
{
LastRunAtTimeStamp = healthReport.LastRunAt?.ToDateTime()
};
}
Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus MapHealthStatus(HealthStatus healthStatus)
{
return healthStatus switch
{View on GitHub (pinned to 25830f84bd)