When to Use This Skill
Use the Debugging skill when you need to:- Trace where an error originates
- Understand why a function is failing
- Find who calls a problematic method
- Investigate unexpected behavior
- Debug 500 errors or crashes
- Understand intermittent failures
Example Scenarios
Why is this function failing?
Why is this function failing?
Use
gitnexus_context to see all callers and callees, then check for external dependencies or data flow issues.Trace where this error comes from
Trace where this error comes from
Use
gitnexus_query with the error message text to find throw sites, then trace backwards through the call chain.Who calls this method?
Who calls this method?
Use
gitnexus_context to get all incoming calls categorized by relationship type (CALLS, IMPORTS).This endpoint returns 500
This endpoint returns 500
Query for the endpoint handler, use context to trace callees, look for external API calls or missing error handling.
Workflow
Follow these steps for effective debugging:Step-by-Step Guide
1. Understand the Symptom Before querying the graph, clearly identify:- Error message (exact text)
- Unexpected behavior description
- Which endpoint/function exhibits the issue
- When it happens (always? intermittent? specific conditions?)
- Processes involving this error (e.g., CheckoutFlow, ErrorHandling)
- Symbols related to the error (validatePayment, handlePaymentError, PaymentException)
- Prioritized by relevance
- Incoming calls: Who triggers this function
- Outgoing calls: What this function depends on
- Processes: Execution flows involving this symbol
Checklist
- Understand the symptom (error message, unexpected behavior)
-
gitnexus_queryfor error text or related code - Identify the suspect function from returned processes
-
gitnexus_contextto see callers and callees - Trace execution flow via process resource if applicable
-
gitnexus_cypherfor custom call chain traces if needed - Read source files to confirm root cause
Debugging Patterns
GitNexus provides different approaches depending on the symptom:| Symptom | GitNexus Approach | Tools to Use |
|---|---|---|
| Error message | Find throw sites, trace backwards | query for error text → context on throw sites |
| Wrong return value | Trace data flow through callees | context on the function → examine outgoing calls |
| Intermittent failure | Look for external dependencies | context → find async calls, external APIs |
| Performance issue | Find hot paths (many callers) | context → check incoming calls count |
| Recent regression | Map what your changes affect | detect_changes to see affected processes |
Tools for Debugging
gitnexus_query
Find code related to an error:- Finding code related to error messages
- Discovering error handling flows
- Locating exception definitions
gitnexus_context
Get full context on a suspect:- Finding who calls the failing function
- Discovering external dependencies
- Understanding data flow
gitnexus_cypher
Custom call chain traces:- Complex call chain analysis
- Finding all paths to a function
- Debugging indirect dependencies
Example: “Payment endpoint returns 500 intermittently”
Here’s a complete debugging walkthrough:Step 1: Understand the Symptom
- What:
/api/checkoutendpoint returns 500 - When: Intermittent (not every request)
- Error: “Payment validation failed”
Step 2: Query for Error Handling
Step 3: Get Context on validatePayment
fetchRates is an external API call—might be timing out!
Step 4: Trace Execution Flow
Step 5: Read Source Code
Readsrc/payments/validator.ts:42:
fetchRates calls an external API without a proper timeout. When the API is slow, the request hangs and eventually times out with 500.
Fix: Add timeout to external API call.
Advanced Debugging Techniques
Finding All Error Throw Sites
Tracing Data Flow
- Use
contextto find where data is created (incoming refs) - Follow outgoing calls to see transformations
- Check process trace to see the full pipeline
Debugging Async Issues
contextto find all async function calls- Look for missing
awaitor error handling - Check for race conditions (multiple callers of same async function)
Best Practices
Look for External Calls
External APIs are common failure points—check
context outgoing calls.Trace Backwards
Start at the error, use
context to find callers, repeat until you reach the entry point.Check Processes
Process traces show the full execution chain—useful for understanding flow.
Use Cypher for Complex Traces
For multi-hop call chains, write custom Cypher queries.
Common Pitfalls
Missing Error Handling
Circular Dependencies
Hot Paths
Next Steps
Learn Impact Analysis
Once you’ve fixed the bug, use impact analysis to ensure your changes don’t break other code