Skip to content

fix(tools): pass errorExtractor to executor and handle all Atlassian error formats#4088

Merged
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/atlassian-error-extractor-fixes
Apr 10, 2026
Merged

fix(tools): pass errorExtractor to executor and handle all Atlassian error formats#4088
waleedlatif1 merged 1 commit intostagingfrom
waleedlatif1/atlassian-error-extractor-fixes

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

@waleedlatif1 waleedlatif1 commented Apr 9, 2026

Summary

  • Pass tool.errorExtractor to extractErrorMessage in the executor — previously the tool-specific extractor ID was never used, so all tools fell back to the generic extraction loop
  • Update parseJsmErrorMessage to handle all Atlassian error formats (errorMessage, errorMessages[], errors[].title RFC 7807, message) instead of only JSM's singular errorMessage
  • Add internal proxy route data.error string fallback to the atlassian-errors extractor so errors from our API routes are properly surfaced

Test plan

  • Trigger an error on a JSM Forms tool and verify the actual Atlassian error message is returned instead of "Request failed with status X"
  • Verify Jira/Confluence error messages also surface correctly
  • Verify happy-path execution is unaffected

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 9, 2026 11:51pm

Request Review

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 9, 2026

PR Summary

Low Risk
Low risk: changes only affect error-message formatting for JSM/Jira/Confluence API failures and do not modify request/response behavior beyond returned error strings.

Overview
Improves parseJsmErrorMessage to recognize multiple Atlassian error payload shapes (single errorMessage, errorMessages[], RFC7807-style errors[], field-level errors objects, and generic message) and return the most specific message available.

Removes the hardcoded "JSM Forms API error:" prefix and falls back to returning raw errorText or ${status} ${statusText} when parsing fails or no structured message is present.

Reviewed by Cursor Bugbot for commit da76758. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Greptile Summary

This PR updates parseJsmErrorMessage in apps/sim/tools/jsm/utils.ts to handle all five Atlassian error formats (errorMessage, errorMessages[], RFC 7807 errors[].title, field-level errors object, and message), matching parity with the atlassian-errors extractor. The three JSM Forms proxy routes (forms/issue, forms/structure, forms/templates) correctly import and use this shared function, so they benefit fully from the fix. However, apps/sim/app/api/tools/jsm/request/route.ts defines its own local copy of parseJsmErrorMessage (only handling errorData.errorMessage) and does not import from utils.ts, leaving jsm_create_request and jsm_get_request error paths unchanged.

Confidence Score: 4/5

Safe to merge for Forms tools; jsm_create_request and jsm_get_request error surfacing remains incomplete.

The shared parseJsmErrorMessage in utils.ts is correctly updated and the three Forms proxy routes will benefit. However, request/route.ts still contains a local copy that only handles errorMessage, so jsm_create_request and jsm_get_request operations won't surface Atlassian error details for the four other error formats. This is a present defect in the changed surface area.

apps/sim/app/api/tools/jsm/request/route.ts — local parseJsmErrorMessage at lines 15–27 should be replaced with an import from @/tools/jsm/utils

Important Files Changed

Filename Overview
apps/sim/tools/jsm/utils.ts parseJsmErrorMessage updated to handle all 5 Atlassian error formats; correctly mirrors the atlassian-errors extractor, but the fix does not reach request/route.ts which still has a stale local copy.

Sequence Diagram

sequenceDiagram
    participant Executor
    participant ProxyRoute as JSM Proxy Route
    participant Atlassian as Atlassian API
    participant Utils as jsm/utils.ts (updated)

    Executor->>ProxyRoute: POST /api/tools/jsm/...
    ProxyRoute->>Atlassian: API call
    Atlassian-->>ProxyRoute: 4xx error body

    alt Forms routes (forms/issue, forms/structure, forms/templates)
        ProxyRoute->>Utils: parseJsmErrorMessage(status, statusText, errorText)
        Note over Utils: Handles all 5 formats:<br/>errorMessage, errorMessages[],<br/>errors[].title, errors{}, message
        Utils-->>ProxyRoute: Formatted error string
        ProxyRoute-->>Executor: { error: "Atlassian error detail" }
    else request/route.ts (jsm_create_request, jsm_get_request)
        Note over ProxyRoute: Local parseJsmErrorMessage<br/>only handles errorData.errorMessage
        ProxyRoute-->>Executor: { error: "JSM API error: 400 Bad Request" } stale fallback
    end
Loading

Comments Outside Diff (1)

  1. apps/sim/app/api/tools/jsm/request/route.ts, line 15-27 (link)

    P1 Stale local copy won't benefit from the fix

    This route defines its own parseJsmErrorMessage that only handles errorData.errorMessage. All other Atlassian error shapes (errorMessages[], RFC 7807 errors[].title, field-level errors object, message) still fall back to "JSM API error: {status} {statusText}". The Forms routes (forms/issue, forms/structure, forms/templates) correctly import the updated shared function from utils.ts — this route should do the same.

Reviews (2): Last reviewed commit: "fix(tools): handle all Atlassian error f..." | Re-trigger Greptile

Update parseJsmErrorMessage to extract errors from all Atlassian API
response formats: errorMessage (JSM), errorMessages array (Jira),
errors[].title RFC 7807 (Confluence/Forms), field-level errors object,
and message (gateway). Remove redundant prefix wrapping so the raw
error message surfaces cleanly through the extractor.
@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/atlassian-error-extractor-fixes branch from c98e80a to da76758 Compare April 9, 2026 23:51
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit da76758. Configure here.

@waleedlatif1 waleedlatif1 merged commit 171485d into staging Apr 10, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/atlassian-error-extractor-fixes branch April 10, 2026 00:08
waleedlatif1 added a commit that referenced this pull request Apr 10, 2026
#4088)

Update parseJsmErrorMessage to extract errors from all Atlassian API
response formats: errorMessage (JSM), errorMessages array (Jira),
errors[].title RFC 7807 (Confluence/Forms), field-level errors object,
and message (gateway). Remove redundant prefix wrapping so the raw
error message surfaces cleanly through the extractor.
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