Bug: Tag mutation hooks crash on non-JSON error responses
Severity: low
Location: client/src/hooks/use-tags.ts:32, :63, :122
Background
Three mutation hooks in use-tags.ts handle HTTP error responses by calling await res.json() without a .catch() fallback. Other hooks in the codebase (e.g., use-conditions.ts:45, use-notification-channels.ts:46) consistently use await res.json().catch(() => ({})) to gracefully handle non-JSON error bodies.
How to Reproduce
- Navigate to tag management
- Trigger a condition where the server returns a non-JSON error (e.g., reverse proxy 502/503 HTML page, WAF interception)
- Attempt to create, update, or assign a tag
Actual Result
Toast displays a SyntaxError like "Unexpected token '<', '<!DOCTYPE '... is not valid JSON" instead of a helpful error message. The real HTTP status and error context are lost.
Expected Result
The hooks should gracefully handle non-JSON error responses by adding .catch(() => ({})) to the res.json() calls on lines 32, 63, and 122, matching the pattern used by useDeleteTag (line 92) in the same file.
Affected hooks
useCreateTag() — line 32
useUpdateTag() — line 63
useSetMonitorTags() — line 122
Found by
Magicwand Phase 6 (Bug Reporter independent scan) on branch claude/test-custom-hooks-ZfYH2
Bug: Tag mutation hooks crash on non-JSON error responses
Severity: low
Location:
client/src/hooks/use-tags.ts:32, :63, :122Background
Three mutation hooks in
use-tags.tshandle HTTP error responses by callingawait res.json()without a.catch()fallback. Other hooks in the codebase (e.g.,use-conditions.ts:45,use-notification-channels.ts:46) consistently useawait res.json().catch(() => ({}))to gracefully handle non-JSON error bodies.How to Reproduce
Actual Result
Toast displays a
SyntaxErrorlike"Unexpected token '<', '<!DOCTYPE '... is not valid JSON"instead of a helpful error message. The real HTTP status and error context are lost.Expected Result
The hooks should gracefully handle non-JSON error responses by adding
.catch(() => ({}))to theres.json()calls on lines 32, 63, and 122, matching the pattern used byuseDeleteTag(line 92) in the same file.Affected hooks
useCreateTag()— line 32useUpdateTag()— line 63useSetMonitorTags()— line 122Found by
Magicwand Phase 6 (Bug Reporter independent scan) on branch
claude/test-custom-hooks-ZfYH2