Skip to content

Commit a26e3f4

Browse files
authored
fix: detect issue short IDs passed to issue list (CLI-C3) (#488)
## Problem When users run `sentry issue list CONVERSATION-SVC-F` or similar commands with an issue short ID, the CLI interprets it as a project slug to search for. Since project slugs are always lowercase and short IDs are uppercase, no project is found and the user sees: ``` ResolutionError: Project 'CONVERSATION-SVC-F' not found. ``` This affects **24 users** ([CLI-C3](https://sentry.sentry.io/issues/7319435132/)). ## Fix Added a pre-flight check in the `project-search` handler of `issue list` that uses the existing `looksLikeIssueShortId()` utility to detect when the input looks like an issue short ID (all-uppercase, dash-separated with alphanumeric suffix). When detected, throws a helpful `ResolutionError` that suggests using `sentry issue view` instead: ``` 'CONVERSATION-SVC-F' looks like an issue short ID, not a project slug. Try: sentry issue view CONVERSATION-SVC-F Or: - To view this issue: sentry issue view CONVERSATION-SVC-F - To list issues in a project: sentry issue list <org>/<project> ``` ## Key Design Decisions - Uses the existing `looksLikeIssueShortId()` pattern which requires all-uppercase with dash separators — this avoids false positives on legitimate lowercase project slugs - Check runs before the API call to `findProjectsBySlug`, saving a round trip - Uses `ResolutionError` (not `ContextError`) because the user provided a value that couldn't be matched
1 parent 94382ba commit a26e3f4

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/commands/issue/list.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import {
1616
listIssuesPaginated,
1717
listProjects,
1818
} from "../../lib/api-client.js";
19-
import { parseOrgProjectArg } from "../../lib/arg-parsing.js";
19+
import {
20+
looksLikeIssueShortId,
21+
parseOrgProjectArg,
22+
} from "../../lib/arg-parsing.js";
2023
import {
2124
buildPaginationContextKey,
2225
clearPaginationCursor,
@@ -387,6 +390,19 @@ async function resolveTargetsFromParsedArg(
387390
}
388391

389392
case "project-search": {
393+
// Detect when user passes an issue short ID instead of a project slug.
394+
// Short IDs like "CONVERSATION-SVC-F" or "CLI-BM" are all-uppercase
395+
// with a dash-separated suffix — a pattern that never occurs in project
396+
// slugs (which are always lowercase).
397+
if (looksLikeIssueShortId(parsed.projectSlug)) {
398+
throw new ResolutionError(
399+
`'${parsed.projectSlug}'`,
400+
"looks like an issue short ID, not a project slug",
401+
`sentry issue view ${parsed.projectSlug}`,
402+
["To list issues in a project: sentry issue list <org>/<project>"]
403+
);
404+
}
405+
390406
// Find project across all orgs
391407
const { projects: matches, orgs } = await findProjectsBySlug(
392408
parsed.projectSlug

0 commit comments

Comments
 (0)