Debug asynchronous code issues including deadlocks and unhandled promises
Help me debug issues in my asynchronous code.
**Programming Language:** {{LANGUAGE}}
**Async code with issues:**
```{{LANGUAGE}}
{{CODE}}
```
**Problem I'm experiencing:**
{{PROBLEM}}
**Expected behavior:**
{{EXPECTED_BEHAVIOR}}
**Actual behavior:**
{{ACTUAL_BEHAVIOR}}
Please provide:
1. **Async Flow Analysis**: Trace the asynchronous execution flow
2. **Issue Identification**: Pinpoint the exact async issue
3. **Deadlock Detection**: Check for potential deadlocks
4. **Promise/Future Handling**: Verify proper promise chaining and error handling
5. **Fixed Code**: Provide corrected async implementation
6. **Error Propagation**: Ensure errors are properly propagated
7. **Testing Approach**: How to test asynchronous code effectively
8. **Common Pitfalls**: List async anti-patterns to avoidOr press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{LANGUAGE][{CODE][{PROBLEM][{EXPECTED_BEHAVIOR][{ACTUAL_BEHAVIOR]