Commit b74d1d6
authored
## Problem
When `sentry issue list` gets a 400 Bad Request from the API, the error
shows the raw API detail but doesn't guide users on what to fix. This is
the most common API error class, affecting **93 users** across
[CLI-BM](https://sentry.sentry.io/issues/7315010148/) (55 users) and
[CLI-7B](https://sentry.sentry.io/issues/7277810245/) (38 users).
Common causes include:
- Invalid Sentry search query syntax (e.g., unparenthesized OR
operators)
- Default `--period 90d` exceeding plan data retention
- Project access issues
## Fix
Added a `build400Detail()` helper that enriches the 400 error detail
with context-aware suggestions based on the current command flags:
**When `--query` is provided:**
```
Failed to fetch issues from 1 project(s): Failed to list issues: 400 Bad Request
Invalid search query: ...
Suggestions:
• Check your --query syntax (Sentry search reference: https://docs.sentry.io/concepts/search/)
• Try a shorter time range: --period 14d or --period 24h
• Verify you have access to the target project: sentry project list <org>/
```
**When using default period (no --query):**
```
Failed to fetch issues from 1 project(s): Failed to list issues: 400 Bad Request
...
Suggestions:
• Try a shorter time range: --period 14d or --period 24h
• Verify you have access to the target project: sentry project list <org>/
```
## Design Decisions
- Suggestions are **appended after** the original API detail so the
specific error reason is shown first
- The query syntax suggestion only appears when `--query` is actually
used
- The period suggestion only appears when using the default 90d (users
who explicitly set a period likely don't need this hint)
- The `build400Detail` function is intentionally narrow-scoped to 400
errors to avoid cluttering other error types
1 parent a26e3f4 commit b74d1d6
1 file changed
+64
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
892 | 892 | | |
893 | 893 | | |
894 | 894 | | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
895 | 950 | | |
896 | 951 | | |
897 | 952 | | |
| |||
1039 | 1094 | | |
1040 | 1095 | | |
1041 | 1096 | | |
1042 | | - | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
1043 | 1101 | | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1044 | 1106 | | |
1045 | 1107 | | |
1046 | 1108 | | |
1047 | | - | |
| 1109 | + | |
1048 | 1110 | | |
1049 | 1111 | | |
1050 | 1112 | | |
| |||
0 commit comments