Skip to content

sentry issue list --json --fields omits count, firstSeen, lastSeen, userCount (missing expand=stats) #969

@sg650

Description

@sg650

Summary

sentry issue list --json --fields count,firstSeen,lastSeen,userCount silently omits those fields from the output, even though --help documents them as available:

--fields  Comma-separated fields to include in JSON output (dot.notation supported).
Available: id, shortId, title, culprit, count, userCount, firstSeen, lastSeen, level, status,
permalink, project, metadata, assignedTo, priority, platform, substatus, isUnhandled, seerFixabilityScore

Steps to Reproduce

# These fields are NOT returned despite being listed as "available":
sentry issue list my-org/my-project \
  --query "is:unresolved" \
  --limit 3 --json \
  --fields shortId,title,level,count,userCount,firstSeen,lastSeen,culprit

# Output — count, userCount, firstSeen, lastSeen are missing:
{
  "data": [
    {
      "shortId": "MY-PROJECT-ABC",
      "title": "Some Error",
      "level": "error",
      "culprit": "MyController#action"
    }
  ]
}

Root Cause

The underlying Sentry API requires expand=stats on the issues endpoint to return count, userCount, firstSeen, and lastSeen. The CLI's issue list command does not pass this parameter.

Workaround — using sentry api directly confirms the fields exist when expand=stats is present:

sentry api 'projects/my-org/my-project/issues/?query=is%3Aunresolved%20age%3A-30d&limit=3&expand=stats' --json \
  | jq '.[0] | {shortId, title, count, userCount, firstSeen, lastSeen}'

# Returns all fields correctly:
{
  "shortId": "MY-PROJECT-ABC",
  "title": "Some Error",
  "count": "15",
  "userCount": 2,
  "firstSeen": "2026-05-12T16:16:34.930604Z",
  "lastSeen": "2026-05-15T15:05:06.603517Z"
}

Additional Context

  • The table output also shows EVENTS: ? and SEEN: — for the same reason
  • --fresh does not change the behavior
  • CLI version: latest (installed today, May 2026)
  • The @sentry/mcp-server does return these fields (it likely passes expand=stats under the hood), but the CLI does not

Expected Behavior

When --fields includes count, firstSeen, lastSeen, or userCount, the CLI should automatically add expand=stats to the API request so those fields are populated in the response.

Impact

This makes sentry issue list --json unsuitable for automation that needs event counts or timestamps — users must fall back to raw sentry api calls with manual URL encoding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions