Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

Fix: dashboard list crash when dashboard title is undefined (CLI-20D) #1094

Closed

Description

@MathurAditya724

Sentry Issue

CLI-20D — TypeError: Cannot read properties of undefined (reading 'replace')

Summary

sentry dashboard list crashes with a TypeError when the Sentry API returns a dashboard with a null or undefined title field. The escapeMarkdownCell() function in the markdown formatter calls .replace() on the value without a null guard.

Root Cause

The DashboardListItemSchema Zod schema marks title as z.string() (required), but this schema is never used for runtime validation — the @sentry/api SDK response is type-cast via as T in unwrapResult(). When a self-hosted Sentry instance returns a dashboard with a missing or null title, the value passes through to the formatter as undefined, bypassing all static type checks.

Crash Site

// src/commands/dashboard/list.ts:157
title: `${escapeMarkdownCell(d.title)}\n${colorTag("muted", url)}`,
//                           ^^^^^^^^ undefined at runtime
// src/lib/formatters/markdown.ts:42-48
export function escapeMarkdownCell(value: string): string {
  return value
    .replace(/\n/g, " ")  // <-- crashes here: Cannot read properties of undefined
    ...

Affected Locations

There are 6 unguarded d.title / item.title accesses across the dashboard domain:

File Line Expression Impact
src/commands/dashboard/list.ts ~157 escapeMarkdownCell(d.title) Crash (reported)
src/commands/dashboard/list.ts ~253 item.title.toLowerCase() Crash during glob filtering
src/commands/dashboard/list.ts ~304 allTitles.push(item.title) Pushes undefined into suggestions
src/commands/dashboard/resolve.ts ~356 d.title.toLowerCase() Crash during title resolution
src/commands/dashboard/resolve.ts ~362 allTitles.push(d.title) Pushes undefined
src/commands/dashboard/resolve.ts ~414 w.title.toLowerCase() Crash during widget resolution

Existing Patterns in the Codebase

The codebase already has established defensive patterns for escapeMarkdownCell:

  • escapeMarkdownCell(breadcrumb.category ?? "default") in human.ts
  • escapeMarkdownCell(item.transaction || "unknown") in trace.ts
  • escapeMarkdownCell(r.url || "") in repo/list.ts

Proposed Fix

  1. Add ?? "(untitled)" fallbacks at all 6 call sites in dashboard/list.ts and dashboard/resolve.ts
  2. Add unit tests verifying dashboard formatting handles undefined/null titles gracefully

Environment

  • Release: 0.36.0
  • Platform: node (self-hosted Sentry, Ubuntu Linux 24.04)
  • Command: sentry dashboard list

Activity

  1. added
    bug
    jared
    on Jun 12, 2026
  2. added a commit that references this issue on Aug 18, 2026
    8f9fd0c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugjared

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions