Skip to content

fix(atlassian): unify error message extraction across all routes#4135

Merged
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/atlassian-error-handling
Apr 13, 2026
Merged

fix(atlassian): unify error message extraction across all routes#4135
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/atlassian-error-handling

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

@waleedlatif1 waleedlatif1 commented Apr 13, 2026

Summary

  • Add parseAtlassianErrorMessage() to jira/utils.ts as single source of truth for parsing all 5 Atlassian error formats (errorMessage, errorMessages[], errors[].title/detail, field-level errors object, message)
  • Update 51 proxy routes (18 JSM, 5 Jira, 28 Confluence) to extract and return actual Atlassian error messages instead of generic "Request failed with status 400" strings
  • Remove dead errorExtractor: 'atlassian-errors' field from 95 Atlassian tool files — the compat loop in extractErrorMessage() handles all formats without it
  • Consolidate duplicate parseJsmErrorMessage into a re-export from the shared utility

Test plan

  • Trigger a 400 error from JSM (e.g., invalid serviceDeskId) and verify the actual error message is returned
  • Trigger a 400 error from Jira (e.g., missing required field) and verify field-level errors are returned
  • Trigger a 400 error from Confluence (e.g., invalid page ID) and verify the error message is returned
  • Verify tools with direct API calls (e.g., jira_search_issues) still extract errors via the compat loop

…and Confluence routes

Add parseAtlassianErrorMessage() to jira/utils.ts as single source of truth for
parsing all 5 Atlassian error formats. Update 51 proxy routes (18 JSM, 5 Jira,
28 Confluence) to use it instead of hardcoded generic errors. Remove dead
errorExtractor field from 95 Atlassian tool files — the compat loop in
extractErrorMessage() already handles all formats without it. Consolidate
duplicate parseJsmErrorMessage into a re-export from the shared utility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Apr 13, 2026 9:29pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 13, 2026

PR Summary

Medium Risk
Touches a large number of Atlassian proxy routes and changes how non-2xx responses are parsed/returned, which could alter client-visible error strings and some edge-case handling. Core auth/data paths aren’t changed, but breadth of updates increases regression risk.

Overview
Unifies Atlassian error handling by introducing parseAtlassianErrorMessage() in tools/jira/utils.ts and switching Jira/JSM/Confluence API proxy routes to read response.text() and return parsed, user-relevant error messages instead of route-specific/JSON-only parsing.

Adjusts JSM request creation so when formAnswers are provided, the request body prioritizes form.answers and only includes requestFieldValues if explicitly supplied, avoiding Atlassian 400s caused by overlapping form-linked fields.

Cleans up tooling/docs metadata by removing errorExtractor: 'atlassian-errors' from many Atlassian tool definitions, updating JSM formAnswers docs/placeholders to reflect numeric question IDs, and making small docs/tag tweaks (e.g., CrowdStrike tags, Trello docs spacing).

Reviewed by Cursor Bugbot for commit 2c8eaa8. Configure here.

- Remove debug logger.info for formAnswers in JSM request route
- Restore user-friendly spaceId error message in Confluence create-page route
- Restore details field in Jira write and update route error responses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ource

Remove re-exports of getJiraCloudId, parseAtlassianErrorMessage, and
parseJsmErrorMessage from jsm/utils.ts. Update all 21 JSM routes to
import directly from @/tools/jira/utils per CLAUDE.md import rules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 13, 2026

Greptile Summary

This PR unifies Atlassian error message extraction across 51 proxy routes (JSM, Jira, Confluence) by introducing a single parseAtlassianErrorMessage() helper in tools/jira/utils.ts, replacing scattered ad-hoc error handling and the now-redundant errorExtractor: 'atlassian-errors' field on 95 tool files. It also fixes a pre-existing bug in the JSM create-request route where providing formAnswers alongside summary/description would set both requestFieldValues and form.answers, potentially causing Atlassian 400 errors.

Confidence Score: 5/5

Safe to merge — all changes are error-handling improvements with no behavioral regressions on the happy path.

All findings are P2 style suggestions. The core logic (parseAtlassianErrorMessage, errorExtractor removal, formAnswers fix) is correct, well-tested per the test plan, and backwards-compatible. No P0/P1 issues found.

No files require special attention; the minor location concern for parseAtlassianErrorMessage in tools/jira/utils.ts is cosmetic.

Important Files Changed

Filename Overview
apps/sim/tools/jira/utils.ts Adds parseAtlassianErrorMessage() as the single source of truth for all five Atlassian error formats; logic is correct and matches the existing atlassian-errors extractor in error-extractors.ts
apps/sim/tools/jsm/utils.ts Removes getJiraCloudId re-export and parseJsmErrorMessage; all callers migrated to import directly from @/tools/jira/utils
apps/sim/app/api/tools/jsm/request/route.ts Fixes formAnswers/requestFieldValues ordering bug (previously both paths could fire causing Atlassian 400s), switches to parseAtlassianErrorMessage, removes local parseJsmErrorMessage duplicate
apps/sim/app/api/tools/confluence/create-page/route.ts Switches from response.json() to response.text() + parseAtlassianErrorMessage; preserves spaceId Long error override correctly
apps/sim/app/api/tools/jira/issues/route.ts Simplifies createErrorResponse helper to use shared parser; no behavioral regression
apps/sim/tools/jsm/create_request.ts Removes dead errorExtractor field; improves formAnswers parameter description to clarify numeric question IDs are required

Reviews (1): Last reviewed commit: "regen docs" | Re-trigger Greptile

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2c8eaa8. Configure here.

@waleedlatif1 waleedlatif1 merged commit 4375f99 into staging Apr 13, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/atlassian-error-handling branch April 13, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant