Unhandled promise rejection in UI after successful MCP tool chain with Write + Linear update
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Unhandled promise rejection error appears in the UI after a successful chain of MCP tool calls that includes Write (large file) + Linear update_issue. All operations complete successfully, but error surfaces during the "accept edits" UI rendering phase.
The workflow that triggers this:
- Create a Linear issue via MCP
- Grep/search operation
- Write a large file (508 lines / 17KB)
- Update the Linear issue via MCP
The error message shows:
"This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch()."
Error appears in the "accept edits" UI section after all operations complete.
What Should Happen?
All tools should complete successfully and the UI should render the "accept edits" interface cleanly without displaying error messages. Since all operations complete successfully (verified via API and file system), no error should be shown to the user.
Error Messages/Logs
⏵⏵ accept edits on (shift+tab to cycle)
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
Steps to Reproduce
- Set up MCP Server connection with linear-server (SSE)
- Execute the following multi-tool workflow:
- Create a Linear issue with mcp__linear-server__create_issue
- Run Grep search operation
- Execute Write command to create a large file (508 lines, 17KB)
- Execute mcp__linear-server__update_issue to update the issue
- Observe the UI after all tools complete streaming their results
All tool operations complete successfully and can be verified:
- Linear issue is created and updated (verify via API)
- File is written to disk successfully (verify with ls)
- No failures in the tool execution logs
Claude Model
None
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
Latest (as of 2025-10-21)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
Key Evidence This Is UI-Only:
- All tool calls return valid JSON responses
- Linear issue created and updated successfully (verified via API)
- File written to disk successfully (verified with ls)
- Error appears after all operations complete
- Error location is in the "accept edits" UI section, not during tool execution
Likely Cause:
Race condition in streaming response handler when multiple async MCP operations complete in quick succession. The Write operation creates a large file while the Linear update response is being processed, causing a promise rejection in the UI rendering layer.
Suggested Fix:
Add proper error handling around the diff/edit acceptance UI promise chain:
try {
await renderEditAcceptanceUI(...)
} catch (error) {
console.error("UI rendering error (non-critical):", error)
// Continue processing, don't surface to user
}
Workaround:
Break complex tool chains into separate user prompts with 1-2 second delays between operations.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗