Paste the Error
The simplest and most effective debugging workflow: paste the error message directly into the chat. The agent will analyze it, locate the relevant code, and propose a fix.
I'm getting this error when I run npm test:
TypeError: Cannot read properties of undefined (reading 'map')
at UserList (src/components/UserList.tsx:23:18)
at renderWithHooks (node_modules/react-dom/...)
at mountIndeterminateComponent (node_modules/react-dom/...)
The test file is tests/UserList.test.tsxThe agent will read the referenced files, understand the data flow, and identify that the component is not handling the case where the user list is undefined. It will then edit the component to add a null check or default value.
Tip
Debugging Workflows
Different types of bugs call for different approaches. Here are the most common debugging workflows.
Runtime Errors
Paste the error message and stack trace. The agent will follow the trace, read the relevant source files, and fix the issue.
Logic Bugs
Describe the expected behavior and actual behavior. The agent will read the relevant code, trace the logic, and identify where the behavior diverges.
The discount calculation is wrong. When a user has a 20% discount code and a $10 loyalty credit, the loyalty credit should be applied after the percentage discount. But right now the credit is applied first, making the percentage discount smaller than it should be. The relevant code is in src/pricing/checkout.ts
Build and Compile Errors
Paste the compiler output. The agent will parse the error messages, navigate to the offending files, and fix type errors, missing imports, or syntax issues.
Performance Issues
Describe the symptom (slow response, high memory, excessive renders) and the agent will analyze the code for common performance issues like N+1 queries, missing memoization, unnecessary re-renders, or inefficient algorithms.
Stack Trace Analysis
The agent is particularly effective at reading stack traces because it can follow each frame through your codebase.
What the Agent Does
- Reads the stack trace and identifies which frames are in your code vs. library code.
- Opens each relevant source file at the referenced line number.
- Traces the data flow from the entry point to the error location.
- Identifies the root cause, which is often several frames above the actual error.
- Proposes a fix at the root cause, not just a workaround at the symptom.
Multi-Language Stack Traces
The agent handles stack traces from any language: JavaScript/TypeScript, Python, Java, Go, Rust, C#, and more. It understands the stack trace format for each language and can navigate your project files accordingly.
Iterative Test Fixing
One of the most powerful debugging workflows is the test-fix loop. The agent runs your tests, reads the failures, fixes the code, and re-runs the tests -- repeating until all tests pass.
Run the tests in tests/pricing/ and fix any failures.
The agent will execute the following loop automatically.
- Run the test suite using your project's test command.
- Parse the test output to identify failing tests.
- Read the test file to understand the expected behavior.
- Read the source file to understand the current implementation.
- Edit the source code to fix the bug.
- Re-run the tests to verify the fix.
- Repeat if there are remaining failures.
Note
Reverting Changes
If the agent makes changes that do not work out, you can revert them. Creor tracks all file modifications made during a session.
Undo Last Change
Click the revert button on any tool call card in the chat timeline to undo that specific change. This restores the file to its state before that edit.
Revert All Session Changes
Use the session menu to revert all changes made in the current session. This is useful when the agent has gone down the wrong path and you want to start fresh.
Git-Based Revert
You can also ask the agent to use git to revert changes.
Revert all the changes you just made and try a different approach. Use git checkout to restore the original files.
Warning
Plan-First Debugging
For complex bugs, use plan mode to analyze the issue before attempting a fix. This is especially useful when you are not sure where the bug originates or when the fix might have wide-reaching implications.
/plan The checkout process fails silently when a user has both a discount code and store credit. Analyze the payment flow and identify where the failure occurs.
The Plan agent will trace the code path, identify potential failure points, and produce a structured analysis. You can then review the findings and ask the Build agent to implement the fix with full understanding of the root cause.
Advanced Techniques
Add Logging
Ask the agent to add temporary logging to trace a runtime issue.
Add console.log statements to trace the data flow through the payment processing pipeline in src/services/payment.ts. Log the input and output of each step.
Reproduce First
Ask the agent to write a test that reproduces the bug before fixing it. This ensures the fix is verified and prevents regressions.
Write a test that reproduces this bug: when the cart is empty and the user applies a discount code, the API returns a 500 instead of a 400. Then fix the bug and verify the test passes.
Binary Search Debugging
For regressions, ask the agent to use git bisect to find the commit that introduced the bug.
Use git bisect to find which commit broke the user search. The test tests/search.test.ts should pass on the good commit and fail on the bad one. HEAD is bad, v2.1.0 is good.