ChatGPT Prompt for Bug Fixing
Diagnose and resolve circular dependency errors commonly encountered in Flask + SQLAlchemy projects.
More prompts for Bug Fixing.
Diagnose and resolve dependency conflicts, version mismatches, and peer dependency issues in any package manager.
Analyze concurrent code for race conditions, deadlocks, and timing bugs with detection strategies and fixes.
Analyze code for memory leak patterns, identify allocation issues, and generate detection and fix strategies.
Guide a structured incident response with root cause analysis, mitigation steps, and post-mortem documentation.
Comprehensive code review guide focused on error handling for Go projects.
Comprehensive code review guide focused on async patterns for Java projects.
You are an experienced software troubleshooter coach who helps self-taught programmers master error resolution through practical, step-by-step guidance. Help me understand and fix circular dependency errors in my Flask + SQLAlchemy application. **Error type:** circular dependency **Tech stack:** Flask + SQLAlchemy **Context:** This error is occurring in production deployment ## Understanding circular dependency Errors - What causes this type of error in the Flask + SQLAlchemy ecosystem - The most common 5 scenarios where this error appears - How to read the error message and stack trace effectively - The difference between the symptom and the root cause ## Diagnostic Flowchart Create a decision tree for diagnosing circular dependency errors: 1. Check the error message -- what keywords indicate which sub-cause? 2. Check the stack trace -- which layer is the error originating from? 3. Check the environment -- is this environment-specific? 4. Check recent changes -- what was deployed or modified recently? 5. Check dependencies -- are there version mismatches? ## Fix Recipes For the top 5 causes of circular dependency in Flask + SQLAlchemy, provide a fix recipe: ### Cause [N]: [Cause Name] - **Symptoms:** What the developer sees - **Root cause:** Why this happens technically - **Quick fix:** The fastest way to resolve it right now - **Proper fix:** The correct long-term solution - **Prevention:** How to prevent this from happening again - **Verification:** How to confirm the fix works ## Edge Cases and Gotchas - 5 tricky variations of circular dependency that look different but have the same cause - Environment-specific issues (development vs. production differences) - Race conditions or timing-dependent occurrences of this error - How cached data or stale state can mask or cause this error ## Automated Detection - Linting or static analysis rules to catch this before runtime - Unit test patterns that would have caught this - Monitoring alerts to detect this in production quickly - Log patterns to search for when investigating this error ## Learning Resources - Key concepts to understand for permanently solving this class of error - Relevant documentation sections for Flask + SQLAlchemy - Common misconceptions that lead to this error Structure as a playbook with: Overview, Prerequisites, Step-by-step Plays, Metrics to Track, and Troubleshooting Guide.
Replace the bracketed placeholders with your own context before running the prompt:
[Cause Name]— fill in your specific cause name.