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.

feat(error-tracking): return smaller stack traces from the issue events mcp tool (#107643)

Hugues Pouillot7f8e424bd36c
diff --git a/products/error_tracking/backend/facade/query_utils.py b/products/error_tracking/backend/facade/query_utils.py
index 3b14a41b1237..c3ba97f1a97c 100644
--- a/products/error_tracking/backend/facade/query_utils.py
+++ b/products/error_tracking/backend/facade/query_utils.py
@@ -6,6 +6,7 @@ from typing import cast
from posthog.hogql.escape_sql import escape_hogql_string
MAX_NORMALIZED_TEXT_CHARS = 1000
+MAX_STACK_FRAMES = 50
# The issue detail tool returns the full description, so list rows keep only a preview.
MAX_LIST_DESCRIPTION_CHARS = 300
@@ -277,8 +278,14 @@ def normalize_stacktrace(
if isinstance(raw_frames, list)
else None
)
+ frames_omitted = 0
+ if frames is not None and len(frames) > MAX_STACK_FRAMES:
+ # Frames run from the outermost call to the frame that raised, so keep the end of the list. A deep
+ # recursion can otherwise return thousands of frames that repeat the same few lines.
+ frames_omitted = len(frames) - MAX_STACK_FRAMES
+ frames = frames[-MAX_STACK_FRAMES:]
base_stacktrace = strip_non_raw_fields(stacktrace_record)
- return compact_dict({**base_stacktrace, "frames": frames})
+ return compact_dict({**base_stacktrace, "frames": frames, "frames_omitted": frames_omitted or None})
def normalize_exception(
@@ -378,6 +385,35 @@ def map_event_row(
return event
+def dedupe_repeated_stacktraces(events: list[dict[str, object]]) -> list[dict[str, object]]:
+ """Replace a stack trace that the page already returned with a reference to the first copy.
+
+ Events of one issue usually share one stack, so a page of sampled events otherwise repeats the same frames once
+ for each event. The reference names the event and the index of the exception in its `$exception_list`, because
+ one event can hold several exceptions with different stacks, and two of them can share a stack. Stacks that
+ differ in any frame, or in code variables, stay in full.
+ """
+ first_copy_by_stack: dict[str, dict[str, object]] = {}
+ for event in events:
+ event_uuid = event.get("uuid")
+ properties = as_record(event.get("properties"))
+ exceptions = properties.get("$exception_list") if properties else None
+ if not isinstance(exceptions, list):
+ continue
+ for index, exception in enumerate(exceptions):
+ exception_record = as_record(exception)
+ stacktrace = as_record(exception_record.get("stacktrace")) if exception_record else None
+ if exception_record is None or stacktrace is None or not stacktrace.get("frames"):
+ continue
+ key = json.dumps(stacktrace, sort_keys=True, default=str)
+ first_copy = first_copy_by_stack.get(key)
+ if first_copy is not None:
+ exception_record["stacktrace"] = dict(first_copy)
+ elif isinstance(event_uuid, str):
+ first_copy_by_stack[key] = {"same_as_event": event_uuid, "same_as_exception": index}
+ return events
+
+
def map_context_event_properties(data: dict[str, object]) -> dict[str, object]:
rows = data.get("results")
row = rows[0] if isinstance(rows, list) and rows else None
diff --git a/products/error_tracking/backend/presentation/views/query.py b/products/error_tracking/backend/presentation/views/query.py
index 5638f4e3b47f..3cd35993c980 100644
--- a/products/error_tracking/backend/presentation/views/query.py
+++ b/products/error_tracking/backend/presentation/views/query.py
@@ -38,6 +38,7 @@ from products.error_tracking.backend.facade.query_utils import (
build_sparkline,
build_top_in_app_frame,
compact_dict,
+ dedupe_repeated_stacktraces,
extract_latest_release,
get_page_info,
map_context_event_properties,
@@ -268,10 +269,12 @@ class ErrorTrackingQueryViewSet(TeamAndOrgViewSetMixin, viewsets.ViewSet):
include_stacktrace = "stacktrace" in includes or "code_variables" in includes
only_app_frames = cast(bool, params.get("onlyAppFrames", True))
include_code_variables = "code_variables" in includes
- results = [
- map_event_row(row, columns, include_stacktrace, only_app_frames, include_code_variables)
- for row in raw_results[:limit]
- ]
+ results = dedupe_repeated_stacktraces(
+ [
+ map_event_row(row, columns, include_stacktrace, only_app_frames, include_code_variables)
+ for row in raw_results[:limit]
+ ]
+ )
has_more, next_offset = get_page_info(data, limit, offset)
payload: dict[str, object] = {"results": results, "hasMore": has_more, "limit": limit, "offset": offset}
if next_offset is not None:
diff --git a/products/error_tracking/backend/tests/api/test_query_api.py b/products/error_tracking/backend/tests/api/test_query_api.py
index ab77d552ba28..41e06753c785 100644
--- a/products/error_tracking/backend/tests/api/test_query_api.py
+++ b/products/error_tracking/backend/tests/api/test_query_api.py
@@ -1,6 +1,7 @@
from __future__ import annotations
from datetime import timedelta
+from typing import Any, cast
import time_machine
from posthog.test.base import APIBaseTest, ClickhouseTestMixin, _create_event, _create_person, flush_persons_and_events
@@ -21,10 +22,13 @@ from posthog.models.utils import generate_random_token_personal, hash_key_value
from products.access_control.backend.models.property_access_control import PropertyAccessControl
from products.access_control.backend.property_access_control import PropertyAccessLevel
from products.error_tracking.backend.facade.query_utils import (
+ MAX_STACK_FRAMES,
build_issue_event_where,
build_issue_filters,
build_search_query,
build_sparkline,
+ dedupe_repeated_stacktraces,
+ normalize_stacktrace,
)
from products.error_tracking.backend.hogql_queries.error_tracking_query_runner import ErrorTrackingQueryRunner
from products.error_tracking.backend.models import (
@@ -72,6 +76,51 @@ def test_build_sparkline_accepts_float_values() -> None:
assert build_sparkline({"aggregations": {"volumeRange": [1.0, 2.5]}}) == [1.0, 2.5]
+def test_normalize_stacktrace_keeps_the_frames_closest_to_the_error() -> None:
+ frames = [{"mangled_name": f"frame_{index}", "in_app": True} for index in range(MAX_STACK_FRAMES + 20)]
+
+ stacktrace = normalize_stacktrace({"frames": frames}, only_app_frames=True)
+
+ assert stacktrace is not None
+ kept = cast(list[dict[str, object]], stacktrace["frames"])
+ assert len(kept) == MAX_STACK_FRAMES
+ assert kept[0]["mangled_name"] == "frame_20"
+ assert kept[-1]["mangled_name"] == f"frame_{MAX_STACK_FRAMES + 19}"
+ assert stacktrace["frames_omitted"] == 20
+
+
+def test_normalize_stacktrace_does_not_mark_a_short_stack() -> None:
+ stacktrace = normalize_stacktrace({"frames": [{"mangled_name": "main", "in_app": True}]}, only_app_frames=True)
+
+ assert stacktrace is not None
+ assert "frames_omitted" not in stacktrace
+
+
+def test_dedupe_repeated_stacktraces_references_the_first_copy_of_the_stack() -> None:
+ def exception(line: int) -> dict[str, object]:
+ frame = {"mangled_name": "submitOrder", "line": line, "in_app": True}
+ return {"type": "TypeError", "stacktrace": {"frames": [frame]}}
+
+ def event(uuid: str, *lines: int) -> dict[str, object]:
+ return {"uuid": uuid, "properties": {"$exception_list": [exception(line) for line in lines]}}
+
+ events = dedupe_repeated_stacktraces(
+ [
+ # Two exceptions with different stacks, then an exception that repeats the first stack in the same event.
+ event("event-1", 42, 43, 42),
+ event("event-2", 43),
+ event("event-3", 44),
+ ]
+ )
+
+ stacks = [[exception["stacktrace"] for exception in cast(Any, e["properties"])["$exception_list"]] for e in events]
+ assert stacks[0][0]["frames"][0]["line"] == 42
+ assert stacks[0][1]["frames"][0]["line"] == 43
+ assert stacks[0][2] == {"same_as_event": "event-1", "same_as_exception": 0}
+ assert stacks[1][0] == {"same_as_event": "event-1", "same_as_exception": 1}
+ assert stacks[2][0]["frames"][0]["line"] == 44
+
+
class TestErrorTrackingQueryAPI(ClickhouseTestMixin, APIBaseTest):
issue_id = "01936e7f-d7ff-7314-b2d4-7627981e34f0"
fingerprint = "issue-fingerprint"
@@ -662,6 +711,39 @@ class TestErrorTrackingQueryAPI(ClickhouseTestMixin, APIBaseTest):
assert "[truncated from 1200 chars]" in summary_event["properties"]["$exception_list"][0]["value"]
assert summary_event["properties"]["$session_id"] == "session-id-1"
+ @time_machine.travel("2026-04-24T12:00:00Z", tick=False)
+ def test_issue_events_returns_a_repeated_stack_trace_once(self) -> None:
+ self.create_issue()
+ exception_list = [
+ {
+ "type": "TypeError",
+ "value": "Cannot read properties of undefined",
+ "stacktrace": {"frames": [{"mangled_name": "submitOrder", "line": 42, "in_app": True}]},
+ }
+ ]
+ for _ in range(2):
+ self.create_exception_event(properties={"$exception_list": exception_list})
+ flush_persons_and_events()
+
+ response = self.client.post(
+ f"/api/environments/{self.team.id}/error_tracking/query/issue_events",
+ data={
+ "issueId": self.issue_id,
+ "dateRange": {"date_from": "-1d", "date_to": "2026-04-25T00:00:00Z"},
+ "include": ["stacktrace"],
+ "limit": 2,
+ },
+ format="json",
+ )
+
+ assert response.status_code == 200
+ first, second = response.json()["results"]
+ assert first["properties"]["$exception_list"][0]["stacktrace"]["frames"][0]["line"] == 42
+ assert second["properties"]["$exception_list"][0]["stacktrace"] == {
+ "same_as_event": first["uuid"],
+ "same_as_exception": 0,
+ }
+
@time_machine.travel("2026-04-24T12:00:00Z", tick=False)
def test_issue_events_returns_only_requested_context_groups(self) -> None:
self.create_issue()
diff --git a/products/error_tracking/mcp/apps/ErrorDetailsView.tsx b/products/error_tracking/mcp/apps/ErrorDetailsView.tsx
index 0b2b842ccefa..843e6b8e44ae 100644
--- a/products/error_tracking/mcp/apps/ErrorDetailsView.tsx
+++ b/products/error_tracking/mcp/apps/ErrorDetailsView.tsx
@@ -3,6 +3,7 @@ import type { ReactElement } from 'react'
import { DescriptionList, formatDate } from '@posthog/mcp-ui'
import { Badge, Card, CardContent, Empty, EmptyDescription, EmptyHeader, EmptyTitle } from '@posthog/quill'
+import { resolveStackReferences } from './stackReferences'
import { type ExceptionData, StackTraceView } from './StackTraceView'
export interface ErrorDetailsEventData {
@@ -62,7 +63,12 @@ export function ErrorDetailsView({ data }: { data: ErrorDetailsData }): ReactEle
// Show the first (most recent) event
const event = events[0]
const properties = event.properties ?? {}
- const exceptions = extractExceptions(properties)
+ const exceptionsByEvent = new Map(
+ events.flatMap((pageEvent) =>
+ pageEvent.uuid ? [[pageEvent.uuid, extractExceptions(pageEvent.properties ?? {})] as const] : []
+ )
+ )
+ const exceptions = resolveStackReferences(extractExceptions(properties), exceptionsByEvent)
const exceptionType = firstString(properties.$exception_types) ?? exceptions[0]?.type ?? 'Error'
const exceptionMessage = firstString(properties.$exception_values) ?? exceptions[0]?.value ?? ''
diff --git a/products/error_tracking/mcp/apps/StackTraceView.tsx b/products/error_tracking/mcp/apps/StackTraceView.tsx
index 7a039d1e7181..74a0a2c239b9 100644
--- a/products/error_tracking/mcp/apps/StackTraceView.tsx
+++ b/products/error_tracking/mcp/apps/StackTraceView.tsx
@@ -27,6 +27,9 @@ export interface ExceptionData {
stacktrace?: {
type?: string
frames?: StackFrame[]
+ frames_omitted?: number
+ same_as_event?: string
+ same_as_exception?: number
}
}
@@ -144,6 +147,11 @@ function ExceptionSection({ exception, index }: { exception: ExceptionData; inde
{inAppCount > 0 && (
<span className="text-xs text-muted-foreground">({inAppCount} in-app)</span>
)}
+ {exception.stacktrace?.frames_omitted ? (
+ <span className="text-xs text-muted-foreground">
+ ({exception.stacktrace.frames_omitted} older frames not shown)
+ </span>
+ ) : null}
</div>
<div className="rounded-lg border overflow-hidden">
<Accordion multiple defaultValue={getDefaultExpanded(displayFrames)}>
diff --git a/products/error_tracking/mcp/apps/stackReferences.test.ts b/products/error_tracking/mcp/apps/stackReferences.test.ts
new file mode 100644
index 000000000000..969cf3c7057f
--- /dev/null
+++ b/products/error_tracking/mcp/apps/stackReferences.test.ts
@@ -0,0 +1,42 @@
+import { resolveStackReferences } from './stackReferences'
+import type { ExceptionData } from './StackTraceView'
+
+const checkoutFrames = [{ mangled_name: 'submitOrder', in_app: true }]
+const cartFrames = [{ mangled_name: 'loadCart', in_app: true }]
+
+describe('resolveStackReferences', () => {
+ it('resolves a reference to an earlier exception of the same event', () => {
+ const exceptions: ExceptionData[] = [
+ { type: 'TypeError', value: 'first', stacktrace: { frames: checkoutFrames } },
+ { type: 'Error', value: 'second', stacktrace: { same_as_event: 'event-1', same_as_exception: 0 } },
+ ]
+
+ const resolved = resolveStackReferences(exceptions, new Map([['event-1', exceptions]]))
+
+ expect(resolved[1].stacktrace?.frames).toEqual(checkoutFrames)
+ expect(resolved[1].value).toBe('second')
+ })
+
+ it('reads a reference to another event from that event, not from the same index of this event', () => {
+ const otherEvent: ExceptionData[] = [{ type: 'TypeError', value: 'other', stacktrace: { frames: cartFrames } }]
+ const exceptions: ExceptionData[] = [
+ { type: 'TypeError', value: 'own', stacktrace: { frames: checkoutFrames } },
+ { type: 'Error', value: 'repeated', stacktrace: { same_as_event: 'event-0', same_as_exception: 0 } },
+ ]
+ const exceptionsByEvent = new Map([
+ ['event-0', otherEvent],
+ ['event-1', exceptions],
+ ])
+
+ expect(resolveStackReferences(exceptions, exceptionsByEvent)[1].stacktrace?.frames).toEqual(cartFrames)
+ })
+
+ it('leaves a reference to an event that is not on the page', () => {
+ const exceptions: ExceptionData[] = [
+ { type: 'TypeError', value: 'own', stacktrace: { frames: checkoutFrames } },
+ { type: 'Error', value: 'repeated', stacktrace: { same_as_event: 'event-9', same_as_exception: 0 } },
+ ]
+
+ expect(resolveStackReferences(exceptions, new Map([['event-1', exceptions]]))).toEqual(exceptions)
+ })
+})
diff --git a/products/error_tracking/mcp/apps/stackReferences.ts b/products/error_tracking/mcp/apps/stackReferences.ts
new file mode 100644
index 000000000000..065bfad2826e
--- /dev/null
+++ b/products/error_tracking/mcp/apps/stackReferences.ts
@@ -0,0 +1,22 @@
+import type { ExceptionData } from './StackTraceView'
+
+/**
+ * The API replaces a stack trace that it already returned on the page with a reference to the first copy:
+ * `{ same_as_event, same_as_exception }`. Replace each reference with the referenced frames. The reference can point
+ * to an earlier exception of the same event or to another event on the page. A reference to an event or an
+ * exception that is not in `exceptionsByEvent` stays as it is.
+ */
+export function resolveStackReferences(
+ exceptions: ExceptionData[],
+ exceptionsByEvent: Map<string, ExceptionData[]>
+): ExceptionData[] {
+ return exceptions.map((exception) => {
+ const eventUuid = exception.stacktrace?.same_as_event
+ const index = exception.stacktrace?.same_as_exception
+ if (eventUuid === undefined || index === undefined) {
+ return exception
+ }
+ const source = exceptionsByEvent.get(eventUuid)?.[index]?.stacktrace
+ return source?.frames?.length ? { ...exception, stacktrace: source } : exception
+ })
+}
diff --git a/products/error_tracking/mcp/prompts/query-error-tracking-issue-events.md b/products/error_tracking/mcp/prompts/query-error-tracking-issue-events.md
index 090c2d202b3b..1a7850f9f817 100644
--- a/products/error_tracking/mcp/prompts/query-error-tracking-issue-events.md
+++ b/products/error_tracking/mcp/prompts/query-error-tracking-issue-events.md
@@ -14,6 +14,11 @@ Returns sampled events with plural exception fields (`$exception_types`, `$excep
- `onlyAppFrames`: defaults to true to reduce vendor-frame noise.
- `limit`: defaults to 1 and maxes at 20. Keep low unless the user asks for multiple examples.
+# Stack traces
+
+- A stack trace keeps at most the 50 frames closest to the error. `frames_omitted` gives the number of older frames that were left out.
+- When a stack trace is the same as one returned earlier on the page, its `stacktrace` is `{"same_as_event": "<uuid>", "same_as_exception": <index>}`. Read the frames from that event, at that index of its `$exception_list`. The event can be the same event, when two of its exceptions share a stack.
+
# Session recordings
When `$session_id` is present and the user asks what happened before the error, call `query-session-recordings-list` with `session_ids` to fetch matching recordings. Use multiple `$session_id` values in one call when available.
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index a4d48672fb71..eba1fbb779e9 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -9437,7 +9437,7 @@
"system_prompt_hint": "Error issue details and impact (error-tracking category)"
},
"query-error-tracking-issue-events": {
- "description": "Fetch sampled `$exception` events for one Error tracking issue.\n\nUse this when the user asks for concrete examples, stack traces, code variables, affected URLs, browser/OS/library context, release details, diagnostics, or Session replay links for a specific issue.\n\nReturns sampled events with plural exception fields (`$exception_types`, `$exception_values`), normalized `$exception_list`, `$exception_fingerprint`, `$exception_level`, `$exception_handled`, `$session_id`, OpenTelemetry and AI trace/span IDs, `$lib`, browser/OS fields, and `$current_url`.\n\n# Parameters\n\n- `issueId`: required Error tracking issue UUID.\n- `dateRange`: time range for sampled events. Defaults to last 7 days.\n- `searchQuery`: search exception types, values, and current URL.\n- `filterGroup`: advanced flat AND property filters applied to sampled events.\n- `include`: context groups to return. Defaults to compact exception, environment, navigation, and correlation context. Add `stacktrace`, `code_variables`, `release`, or `diagnostics` only when needed. `code_variables` implies stack frames and may contain SDK-masked sensitive values.\n- `onlyAppFrames`: defaults to true to reduce vendor-frame noise.\n- `limit`: defaults to 1 and maxes at 20. Keep low unless the user asks for multiple examples.\n\n# Session recordings\n\nWhen `$session_id` is present and the user asks what happened before the error, call `query-session-recordings-list` with `session_ids` to fetch matching recordings. Use multiple `$session_id` values in one call when available.",
+ "description": "Fetch sampled `$exception` events for one Error tracking issue.\n\nUse this when the user asks for concrete examples, stack traces, code variables, affected URLs, browser/OS/library context, release details, diagnostics, or Session replay links for a specific issue.\n\nReturns sampled events with plural exception fields (`$exception_types`, `$exception_values`), normalized `$exception_list`, `$exception_fingerprint`, `$exception_level`, `$exception_handled`, `$session_id`, OpenTelemetry and AI trace/span IDs, `$lib`, browser/OS fields, and `$current_url`.\n\n# Parameters\n\n- `issueId`: required Error tracking issue UUID.\n- `dateRange`: time range for sampled events. Defaults to last 7 days.\n- `searchQuery`: search exception types, values, and current URL.\n- `filterGroup`: advanced flat AND property filters applied to sampled events.\n- `include`: context groups to return. Defaults to compact exception, environment, navigation, and correlation context. Add `stacktrace`, `code_variables`, `release`, or `diagnostics` only when needed. `code_variables` implies stack frames and may contain SDK-masked sensitive values.\n- `onlyAppFrames`: defaults to true to reduce vendor-frame noise.\n- `limit`: defaults to 1 and maxes at 20. Keep low unless the user asks for multiple examples.\n\n# Stack traces\n\n- A stack trace keeps at most the 50 frames closest to the error. `frames_omitted` gives the number of older frames that were left out.\n- When a stack trace is the same as one returned earlier on the page, its `stacktrace` is `{\"same_as_event\": \"<uuid>\", \"same_as_exception\": <index>}`. Read the frames from that event, at that index of its `$exception_list`. The event can be the same event, when two of its exceptions share a stack.\n\n# Session recordings\n\nWhen `$session_id` is present and the user asks what happened before the error, call `query-session-recordings-list` with `session_ids` to fetch matching recordings. Use multiple `$session_id` values in one call when available.",
"category": "Error tracking",
"feature": "error_tracking",
"summary": "Query error tracking issue events",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 7bc6661ce7f4..ab26ba87ad6e 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -9998,7 +9998,7 @@
"system_prompt_hint": "Error issue details and impact (error-tracking category)"
},
"query-error-tracking-issue-events": {
- "description": "Fetch sampled `$exception` events for one Error tracking issue.\n\nUse this when the user asks for concrete examples, stack traces, code variables, affected URLs, browser/OS/library context, release details, diagnostics, or Session replay links for a specific issue.\n\nReturns sampled events with plural exception fields (`$exception_types`, `$exception_values`), normalized `$exception_list`, `$exception_fingerprint`, `$exception_level`, `$exception_handled`, `$session_id`, OpenTelemetry and AI trace/span IDs, `$lib`, browser/OS fields, and `$current_url`.\n\n# Parameters\n\n- `issueId`: required Error tracking issue UUID.\n- `dateRange`: time range for sampled events. Defaults to last 7 days.\n- `searchQuery`: search exception types, values, and current URL.\n- `filterGroup`: advanced flat AND property filters applied to sampled events.\n- `include`: context groups to return. Defaults to compact exception, environment, navigation, and correlation context. Add `stacktrace`, `code_variables`, `release`, or `diagnostics` only when needed. `code_variables` implies stack frames and may contain SDK-masked sensitive values.\n- `onlyAppFrames`: defaults to true to reduce vendor-frame noise.\n- `limit`: defaults to 1 and maxes at 20. Keep low unless the user asks for multiple examples.\n\n# Session recordings\n\nWhen `$session_id` is present and the user asks what happened before the error, call `query-session-recordings-list` with `session_ids` to fetch matching recordings. Use multiple `$session_id` values in one call when available.",
+ "description": "Fetch sampled `$exception` events for one Error tracking issue.\n\nUse this when the user asks for concrete examples, stack traces, code variables, affected URLs, browser/OS/library context, release details, diagnostics, or Session replay links for a specific issue.\n\nReturns sampled events with plural exception fields (`$exception_types`, `$exception_values`), normalized `$exception_list`, `$exception_fingerprint`, `$exception_level`, `$exception_handled`, `$session_id`, OpenTelemetry and AI trace/span IDs, `$lib`, browser/OS fields, and `$current_url`.\n\n# Parameters\n\n- `issueId`: required Error tracking issue UUID.\n- `dateRange`: time range for sampled events. Defaults to last 7 days.\n- `searchQuery`: search exception types, values, and current URL.\n- `filterGroup`: advanced flat AND property filters applied to sampled events.\n- `include`: context groups to return. Defaults to compact exception, environment, navigation, and correlation context. Add `stacktrace`, `code_variables`, `release`, or `diagnostics` only when needed. `code_variables` implies stack frames and may contain SDK-masked sensitive values.\n- `onlyAppFrames`: defaults to true to reduce vendor-frame noise.\n- `limit`: defaults to 1 and maxes at 20. Keep low unless the user asks for multiple examples.\n\n# Stack traces\n\n- A stack trace keeps at most the 50 frames closest to the error. `frames_omitted` gives the number of older frames that were left out.\n- When a stack trace is the same as one returned earlier on the page, its `stacktrace` is `{\"same_as_event\": \"<uuid>\", \"same_as_exception\": <index>}`. Read the frames from that event, at that index of its `$exception_list`. The event can be the same event, when two of its exceptions share a stack.\n\n# Session recordings\n\nWhen `$session_id` is present and the user asks what happened before the error, call `query-session-recordings-list` with `session_ids` to fetch matching recordings. Use multiple `$session_id` values in one call when available.",
"category": "Error tracking",
"feature": "error_tracking",
"summary": "Query error tracking issue events",