{"record":{"id":"258e494821a75c98","repo":"microsoft/aspire","slug":"internalerror-258e49","errorCode":"InternalError","errorMessage":"{errorMessage: 'Failed to fetch structured logs for trace: {ex.Message}' or dashboard API error message}","messagePattern":"(.+?)' or dashboard API error message\\}","errorType":"error_code","errorClass":"McpProtocolException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Cli/Mcp/Tools/ListTraceStructuredLogsTool.cs","lineNumber":131,"sourceCode":"                {limitMessage}\n\n                # STRUCTURED LOGS DATA\n\n                {logsData}\n                \"\"\";\n\n            return new CallToolResult\n            {\n                Content = [new TextContentBlock { Text = text }]\n            };\n        }\n        catch (HttpRequestException ex)\n        {\n            logger.LogError(ex, \"Failed to fetch structured logs for trace from Dashboard API\");\n            var errorMessage = dashboardInfoProvider.IsDirectConnection\n                ? await TelemetryCommandHelpers.GetDashboardApiErrorMessageAsync(ex, apiBaseUrl, httpClientFactory, logger, cancellationToken)\n                : $\"Failed to fetch structured logs for trace: {ex.Message}\";\n            throw new McpProtocolException(errorMessage, McpErrorCode.InternalError);\n        }\n    }\n}\n","sourceCodeStart":113,"sourceCodeEnd":135,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Cli/Mcp/Tools/ListTraceStructuredLogsTool.cs#L113-L135","documentation":"Thrown by ListTraceStructuredLogsTool.CallToolAsync when the HTTP call to the dashboard API for a trace's structured logs raises HttpRequestException. Message is either the dashboard API's own error text (direct connection) or 'Failed to fetch structured logs for trace: <ex.Message>'; code InternalError (-32603).","triggerScenarios":"Requesting structured logs for a specific trace ID while the dashboard API endpoint is unreachable, the base URL/token is stale, or the proxied connection fails mid-request.","commonSituations":"AppHost/dashboard restarted so cached dashboard info is stale; telemetry endpoint temporarily unavailable; network proxy interference; trace requested concurrently with app shutdown.","solutions":["Confirm the dashboard API base URL is reachable and retry the trace query.","Restart the AppHost (or re-fetch dashboard info) to refresh endpoints and token.","Check proxies/firewalls/DNS for the dashboard host.","Read the underlying HttpRequestException in the CLI logs ('Failed to fetch structured logs for trace from Dashboard API') for the socket-level cause."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Ensure dashboard API reachability before trace log queries\nvar response = await httpClient.GetAsync(apiBaseUrl, HttpCompletionOption.ResponseHeadersRead, ct);\nresponse.EnsureSuccessStatusCode();","typeGuard":null,"tryCatchPattern":"try\n{\n    await ListTraceStructuredLogsAsync(traceId);\n}\ncatch (McpProtocolException ex) when (ex.Message.Contains(\"Failed to fetch structured logs for trace\"))\n{\n    // Refresh dashboard endpoints/token and retry once\n    await RefreshDashboardInfoAsync();\n    await ListTraceStructuredLogsAsync(traceId);\n}","preventionTips":["Obtain fresh dashboard info after AppHost restarts before trace queries.","Verify trace IDs exist and the app is still emitting telemetry.","Check proxy/DNS/firewall reachability of the dashboard API host.","Retry transient network failures with a short backoff."],"tags":["mcp","http","traces","dashboard-api","aspire-cli"],"backgroundTag":"http-request-failed","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"}