{"record":{"id":"762e5f3a5dc025ae","repo":"microsoft/aspire","slug":"browser-profile-0-was-not-found-under-1-specify-the-profile","errorCode":null,"errorMessage":"Browser profile '{0}' was not found under '{1}'. Specify the profile directory name (for example 'Default' or 'Profile 1') or a browser profile name from Chromium's profile metadata.","messagePattern":"Browser profile '(.+?)' was not found under '(.+?)'\\. Specify the profile directory name \\(for example 'Default' or 'Profile 1'\\) or a browser profile name from Chromium's profile metadata\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Browsers/ChromiumBrowserResolver.cs","lineNumber":112,"sourceCode":"                throw new InvalidOperationException(\n                    string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsUnableToReadProfileMetadata, localStatePath, profile),\n                    ex);\n            }\n            catch (UnauthorizedAccessException ex)\n            {\n                throw new InvalidOperationException(\n                    string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsUnableToReadProfileMetadata, localStatePath, profile),\n                    ex);\n            }\n            catch (JsonException ex)\n            {\n                throw new InvalidOperationException(\n                    string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsInvalidProfileMetadata, localStatePath, profile),\n                    ex);\n            }\n        }\n\n        throw new InvalidOperationException(\n            string.Format(CultureInfo.CurrentCulture, BrowserMessageStrings.BrowserLogsProfileNotFound, profile, userDataDirectory));\n    }\n\n    /// <summary>\n    /// Resolves a profile directory from Chromium's parsed Local State metadata.\n    /// </summary>\n    internal static string? TryResolveProfileDirectory(JsonElement localStateRoot, string userDataDirectory, string profile)\n    {\n        ArgumentException.ThrowIfNullOrWhiteSpace(userDataDirectory);\n        ArgumentException.ThrowIfNullOrWhiteSpace(profile);\n\n        if (!localStateRoot.TryGetProperty(\"profile\", out var profileElement) ||\n            !profileElement.TryGetProperty(\"info_cache\", out var infoCacheElement) ||\n            infoCacheElement.ValueKind != JsonValueKind.Object)\n        {\n            return null;\n        }\n","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Browsers/ChromiumBrowserResolver.cs#L94-L130","documentation":"After checking both a direct directory-name match and Chromium's profile metadata, ResolveProfileDirectory throws this if no profile directory matching the requested name/display name was found under the user data directory. The message advises using the profile directory name ('Default', 'Profile 1') or a display name from Chromium metadata.","triggerScenarios":"Calling ResolveProfileDirectory with a profile value that matches neither any subdirectory name nor any info_cache entry in Local State under userDataDirectory.","commonSituations":"Typing a friendly profile label that was never created; referencing a profile on a machine where it doesn't exist; assuming 'Profile 0' numbering when Chromium uses 'Profile 1', 'Profile 2', etc.; case/format mistakes in the directory name.","solutions":["List subdirectories under the user data directory and use the exact directory name (e.g., 'Default', 'Profile 1').","Open chrome://version or Chrome's profile picker to find the correct profile identifier.","Fix typos/casing in the profile argument (directory-name matching is ordinal).","Create the desired profile in the browser before referencing it."],"exampleFix":"// before\nvar dir = resolver.ResolveProfileDirectory(userData, \"work account\");\n// after\n// 'Profile 1' is the actual directory Chromium created\nvar dir = resolver.ResolveProfileDirectory(userData, \"Profile 1\");","handlingStrategy":"validation","validationCode":"var candidates = Directory.GetDirectories(userDataDirectory)\n    .Where(d => Path.GetFileName(d).Equals(profile, StringComparison.Ordinal))\n    .ToList();\nif (candidates.Count == 0)\n{\n    throw new ArgumentException($\"Profile '{profile}' not found. Available: {string.Join(\", \", Directory.GetDirectories(userDataDirectory).Select(Path.GetFileName))}\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    var dir = resolver.ResolveProfileDirectory(userData, profile);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"was not found under\"))\n{\n    // list available profiles and re-prompt the user\n}","preventionTips":["Discover profile directory names dynamically instead of guessing.","Remember Chromium numbering starts at 'Profile 1', not 'Profile 0'.","Match ordinal-exactly — directory names are case-sensitive in the resolver."],"tags":["browser","chromium","profile","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}