microsoft/aspire · error · InvalidOperationException
Unable to read Chromium profile metadata from
Error message
Unable to read Chromium profile metadata from '{0}' while resolving browser profile '{1}'. What it means
When parsing Chromium's 'Local State' metadata file to resolve a profile, an IOException while reading the file is wrapped in this InvalidOperationException (with localStatePath and profile interpolated). The library treats an unreadable metadata file as a resolution failure rather than silently ignoring the profile.
Solutions
- Close all running Chromium/Chrome instances so the Local State file is not locked, then retry.
- Retry after a short delay if the file was transiently locked (AV scan, sync tool).
- Verify the user data directory is a complete, healthy Chrome profile copy.
- Catch this exception and fall back to specifying the profile by directory name without metadata lookup.
Example fix
// before
var dir = resolver.ResolveProfileDirectory(userData, "Work");
// after
try
{
var dir = resolver.ResolveProfileDirectory(userData, "Work");
}
catch (InvalidOperationException) when (chromeIsRunning)
{
// prompt user to close Chrome and retry
} Defensive patterns
Strategy: retry
Validate before calling
// Ensure no Chromium processes hold the metadata file
var chromeRunning = Process.GetProcessesByName("chrome").Length > 0;
if (chromeRunning) { /* prompt to close or use a copy */ } Try / catch
try
{
var dir = resolver.ResolveProfileDirectory(userData, profile);
}
catch (InvalidOperationException ex) when (ex.InnerException is IOException)
{
await Task.Delay(500);
// retry once, else fall back to directory-name resolution
} Prevention
- Close running Chromium instances before resolving profiles.
- Exclude the profile directory from AV/backup locks during resolution.
- Work on a complete copy of the profile rather than the live one.
When it happens
Trigger: ResolveProfileDirectory attempts to read <userDataDirectory>/Local State and the underlying file read throws IOException — e.g., disk error, file locked by a running browser, or the path is a directory.
Common situations: Chrome is running and holds the Local State file with conflicting locks; the profile directory was partially copied/synced; antivirus or backup software temporarily locks the file; disk/network drive issues.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Browser profile ' ' matched multiple Chromium profiles…
- Browser profile ' ' was not found under ' '. Specify the…
- Browser user data directory
- BrowserMessageStrings.BrowserLogsUnableToLocateBrowser
- Chromium profile metadata in
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/9cb393cfb78e6aa2.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Browsers/ChromiumBrowserResolver.cs:94
// "Profile 1": { "name": "Work", "shortcut_name": "Work" }
// }
// }
// }
var localStatePath = Path.Combine(userDataDirectory, "Local State");
if (File.Exists(localStatePath))
{
try
{
using var localStateStream = File.OpenRead(localStatePath);
using var localStateDocument = JsonDocument.Parse(localStateStream);
if (TryResolveProfileDirectory(localStateDocument.RootElement, userDataDirectory, profile) is { } profileDirectory)
{
return profileDirectory;
}
}
catch (IOException ex)
{
throw new InvalidOperationException(
string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsUnableToReadProfileMetadata, localStatePath, profile),
ex);
}
catch (UnauthorizedAccessException ex)
{
throw new InvalidOperationException(
string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsUnableToReadProfileMetadata, localStatePath, profile),
ex);
}
catch (JsonException ex)
{
throw new InvalidOperationException(
string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsInvalidProfileMetadata, localStatePath, profile),
ex);
}
}
throw new InvalidOperationException(View on GitHub (pinned to 25830f84bd)