You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
log list/view returns 400 when user passes --query with non-numeric project slug #1319
When the user passes a --query flag (or the command auto-injects one), the resulting ?query=project:<slug> <user-query> is malformed search syntax and the Events API rejects it with 400 Bad Request. This is the same root cause as #1317 (slug scoping via query syntax instead of the project= parameter) but surfaces as a 400 instead of empty data: [].
Evidence
Sentry telemetry (sentry/cli project) shows two long-lived issue groups entirely caused by this pattern:
CLI-R2 — ApiError: Failed to list logs: 400 Bad Request — 316 events, first seen 2026-05-03, still active (lastSeen 2026-07-30)
Every sampled event's HTTP breadcrumb shows the same malformed query, e.g.:
GET https://us.sentry.io/api/0/organizations/nineyard/events/
?dataset=logs&...&query=project%3Abackground-server%20Recalc%3A%20chain
The user's --query "Recalc: chain" is being naively concatenated after project:<slug>. The Events API doesn't accept that as valid search syntax (two search tokens smashed together without proper operators/parens) and returns 400.
Workaround
Pass the numeric project id instead of the slug:
sentry log list <org>/<project-id> --query "Recalc: chain"
Fix direction
Mirror #1317 / PR #312: resolve the slug to its numeric project ID and pass it via the project query parameter (Array<number>) instead of injecting project:<slug> into the search query. After the fix, the same call becomes ?query=Recalc%3A%20chain&project=<id> — no concatenation, no 400.
Already addressed for log list and log view by #1318.
This is the same root cause as #1317 and is already fixed by #1318, which is open, approved, CI-green, and marked Closes #1319.
#1318 replaces the project:<slug> query-string scoping with the numeric project param in both code paths #1319 references:
listLogs in src/lib/api/logs.ts (the log list path) — the naive project:<slug> <user-query> concatenation that produced the 400 is gone; the query is now just the user query with project=<id>.
getLogsBatch (the log view path) — same treatment.
No separate PR needed; this will be resolved when #1318 merges.
Activity
jared-outpost commentedon Jul 30, 2026
This is the same root cause as #1317 and is already fixed by #1318, which is open, approved, CI-green, and marked
Closes #1319.#1318 replaces the
project:<slug>query-string scoping with the numericprojectparam in both code paths #1319 references:listLogsinsrc/lib/api/logs.ts(thelog listpath) — the naiveproject:<slug> <user-query>concatenation that produced the 400 is gone; the query is now just the user query withproject=<id>.getLogsBatch(thelog viewpath) — same treatment.No separate PR needed; this will be resolved when #1318 merges.
fix(log): scope log queries by numeric project ID (#1318)