Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(mcp-analytics): stop guessing why a failure has no error message (#92676)

Georgis Andonisb20264e483f7
diff --git a/products/mcp_analytics/frontend/MCPAnalyticsToolDetail.tsx b/products/mcp_analytics/frontend/MCPAnalyticsToolDetail.tsx
index e1a6489ed3ed..27a20f7fada0 100644
--- a/products/mcp_analytics/frontend/MCPAnalyticsToolDetail.tsx
+++ b/products/mcp_analytics/frontend/MCPAnalyticsToolDetail.tsx
@@ -1,7 +1,7 @@
import { useActions, useValues } from 'kea'
import { useMemo } from 'react'
-import { IconArrowLeft, IconArrowRight, IconCopy } from '@posthog/icons'
+import { IconArrowLeft, IconArrowRight, IconCopy, IconInfo } from '@posthog/icons'
import { LemonButton, LemonDivider, LemonModal, LemonSkeleton, Tooltip } from '@posthog/lemon-ui'
import {
type ChartTheme,
@@ -786,9 +786,11 @@ function FailureOccurrencesModal({ toolName }: { toolName: string }): JSX.Elemen
{String(r[2])}
</span>
) : (
- <span className="text-muted text-xs">
- Not captured (event predates error message capture)
- </span>
+ <Tooltip title="No $mcp_error_message on this event. Check that your MCP server sends it on failed tool calls.">
+ <span className="text-muted text-xs whitespace-nowrap">
+ Not captured <IconInfo />
+ </span>
+ </Tooltip>
),
},
{
diff --git a/products/mcp_analytics/frontend/tool-quality/errorContext.test.ts b/products/mcp_analytics/frontend/tool-quality/errorContext.test.ts
index f8e99c12f97c..7676194a391d 100644
--- a/products/mcp_analytics/frontend/tool-quality/errorContext.test.ts
+++ b/products/mcp_analytics/frontend/tool-quality/errorContext.test.ts
@@ -37,6 +37,19 @@ describe('formatErrorContext', () => {
expect(out).not.toMatch(/^## (injected|New|bare)/m)
})
+ // An absent $mcp_error_message has several causes (an SDK that doesn't emit it, a
+ // dispatcher that never passes the error, autocapture off, a blank message), and this
+ // text is prefilled into a coding agent's task description — so it names the missing
+ // property and stops there rather than asserting one of them.
+ it('names the missing property when the event carries no error message', () => {
+ const out = formatErrorContext({
+ toolName: 'query_run',
+ errorType: 'internal',
+ })
+ expect(out).toContain('Error message: not captured (no $mcp_error_message on this event).')
+ expect(out).not.toContain('predates')
+ })
+
it('collapses newlines in inline telemetry fields so they stay on their list line', () => {
const out = formatErrorContext({
toolName: 'query_run',
diff --git a/products/mcp_analytics/frontend/tool-quality/errorContext.ts b/products/mcp_analytics/frontend/tool-quality/errorContext.ts
index f71d10931278..d2bdba0fde8a 100644
--- a/products/mcp_analytics/frontend/tool-quality/errorContext.ts
+++ b/products/mcp_analytics/frontend/tool-quality/errorContext.ts
@@ -62,7 +62,7 @@ export function formatErrorContext(ctx: MCPErrorContext): string {
if (ctx.errorMessage) {
lines.push('', 'Error message:', '', ...indentedBlock(ctx.errorMessage))
} else {
- lines.push('', 'Error message: not captured (event predates error message capture).')
+ lines.push('', 'Error message: not captured (no $mcp_error_message on this event).')
}
lines.push('', `Tool report: ${absoluteUrl(urls.mcpAnalyticsTool(ctx.toolName))}`)
if (ctx.sessionId) {