Troubleshooting Guide
agentful usually runs smoothly, but when issues arise, this guide helps you diagnose and resolve them quickly.
Quick Diagnostic Steps
Before diving into specific issues, run these checks:
# 1. Check agentful state
/agentful-status
# 2. Check validation status
/agentful-validate
# 3. Check for decisions
cat .agentful/decisions.json
# 4. Check for TypeScript errors
npx tsc --noEmit
# 5. Check tests
npm testThis tells you:
- Where agentful is stuck
- What's failing validation
- If decisions are blocking progress
- If there are basic code issues
Common Issues by Category
Category 1: agentful Seems Stuck
Symptom 1.1: No Progress After Many Iterations
What you see:
Running iteration 25...
Working on: User authentication
No changes in last 10 iterationsDiagnosis:
# Check what's happening
/agentful-status
# Check state file
cat .agentful/state.json
# Check if decisions are blocking
cat .agentful/decisions.json | jq '.pending'Common causes:
- Pending decision blocking work
- Validation loop (can't pass gates)
- Agent doesn't know what to do next
- PRODUCT.md unclear
Solution 1.1: Check for Decisions
If pending decisions exist:
{
"pending": [
{
"id": "decision-003",
"question": "Should auth use JWT or sessions?",
"blocking": ["authentication", "user-profile"]
}
]
}Fix: Run decision handler
/agentful-decide
# Provide your answer:
Option 1: JWT (stateless, scalable)agentful will resume immediately.
Solution 1.2: Check for Validation Loops
If status shows validation passing and failing repeatedly:
# Check last validation
cat .agentful/last-validation.json
# Check what's failing
jq '.checks | to_entries[] | select(.value.passed == false)'Common validation loop causes:
Cause A: Dead Code Can't Be Fixed
Symptom: Reviewer finds dead code, Fixer can't remove it
Example:
// Export is marked unused, but it IS used
export function utilityFunction() { ... }
// ts-prune says unused, but dynamic import uses it:
const module = await import('./utils');
module.utilityFunction();Fix: Add technical note to PRODUCT.md
**Technical Notes**:
- utilityFunction in src/utils/index.ts is dynamically imported
- Ignore dead code warnings for this functionOr whitelist in reviewer agent:
## Dead Code Whitelist
- src/utils/index.ts:utilityFunction (dynamically imported)Cause B: Test Coverage Stuck Below 80%
Symptom:
Coverage at 72%, needs 80%
Coverage at 75%, needs 80%
Coverage at 77%, needs 80%
[Stuck here]Why: agentful adding tests but not enough
Fix: Identify uncovered code
npm test -- --coverage --reporters=json
# Check coverage report for uncovered filesManual intervention: Add critical tests yourself
# Let agentful handle easy tests, you write complex ones
# Then re-run:
/agentful-validateOr temporarily lower threshold (for MVP):
Edit .claude/agents/reviewer.md:
### 6. Coverage Check
**FAIL if:** Coverage < 70% # Temporarily loweredCause C: Type Errors agentful Can't Resolve
Symptom: Same type error appears repeatedly
Example:
// Error: Property 'userId' does not exist on type 'Session'
const userId = session.userId;Fix: Run type check manually to see full error
npx tsc --noEmit
# Output:
src/app/api/auth/route.ts:15:25 - error TS2339:
Property 'userId' does not exist on type 'Session'.Fix the type definition yourself:
// Add missing property
interface Session {
userId: string;
token: string;
}Then resume:
/agentful-startSolution 1.3: Unclear PRODUCT.md
If agentful keeps reading PRODUCT.md but not building:
Check:
# See what agentful is trying to understand
# Look in conversation history for:
# "Reading PRODUCT.md..."
# "Analyzing feature X..."
# "Need clarification on..."Fix: Add detail to unclear features
# Before (vague)
### 3. User Profile - HIGH
Users can see their profile.
# After (specific)
### 3. User Profile - HIGH
**Description**: Users can view and edit their profile information
**Acceptance Criteria**:
- [ ] Display user name, email, avatar
- [ ] Edit form for name and avatar URL
- [ ] Email is read-only (can't change)
- [ ] Save button updates user in database
- [ ] Cancel button reverts changesSymptom 1.4: agentful Stops Without Completing
What you see:
Feature complete: User authentication (100%)
[agentful exits]But: More features remain in PRODUCT.md
Diagnosis:
# Check completion
cat .agentful/completion.json
# Check state
cat .agentful/state.jsonPossible causes:
Cause A: Ralph Loop Reached Max Iterations
If using Ralph loop:
/ralph-loop "/agentful-start" --max-iterations 50agentful stops after 50 iterations even if incomplete.
Fix: Increase limit or remove it
/ralph-loop "/agentful-start" --max-iterations 100Or run without limit (use caution):
/ralph-loop "/agentful-start"Cause B: All Remaining Features Blocked
Decisions blocking all remaining workFix: Run /agentful-decide to unblock
Cause C: Completion.json Marked Complete Incorrectly
Manual correction needed:
# Edit .agentful/completion.json
# Change feature status from "complete" to "in_progress"
# Then resume:
/agentful-startCategory 2: Validation Failures
Symptom 2.1: Tests Keep Failing
What you see:
Test: User login
Expected: 200 status
Received: 401 status
❌ FAILDiagnosis:
# Run tests manually to see full output
npm test
# Check test file
cat src/__tests__/auth.test.tsCommon causes:
Cause A: Test Out of Sync with Implementation
Code changed, test didn't updateExample:
// Test expects:
expect(response.status).toBe(200);
// But code returns:
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });Fix: Update test to match implementation (or vice versa)
Prevention: Tell agentful to regenerate tests
**Technical Notes**:
- Regenerate all tests for this feature to match current implementationCause B: Missing Test Setup
Test uses data that doesn't existExample:
// Test expects:
const user = await createUser({ email: "test@example.com" });
// But createUser not mocked or doesn't existFix: Add setup/teardown to test
beforeEach(async () => {
await setupTestData();
});
afterEach(async () => {
await cleanupTestData();
});Cause C: Async/ Await Issues
Test doesn't wait for async codeExample:
// Wrong (missing await):
act(() => {
render(<Login />);
});
expect(screen.getByText("Welcome")).toBeInTheDocument();
// Correct:
await act(async () => {
render(<Login />);
});
expect(await screen.findByText("Welcome")).toBeInTheDocument();Fix: Add await and async properly
Symptom 2.2: TypeScript Errors Won't Go Away
What you see:
error TS2322: Type 'string' is not assignable to type 'number'Diagnosis:
npx tsc --noEmitCommon causes:
Cause A: Type Mismatch
// Function expects number, receives string
function setId(id: number) { ... }
setId("123"); // Error: string not assignable to numberFix: Convert type
setId(parseInt("123"));
// OR update function to accept string
function setId(id: string | number) { ... }Cause B: Missing Type Definition
// Using library without types
import { someLibrary } from 'untyped-library';
// Error: Could not find namespace for someLibraryFix: Install types
npm install --save-dev @types/untyped-libraryOr add declaration:
declare module 'untyped-library';Cause C: Strict null Checks
// Might be undefined
const user = users.find(id);
// Error: Object is possibly 'undefined'
console.log(user.name);Fix: Add check
const user = users.find(id);
if (!user) {
throw new Error("User not found");
}
console.log(user.name);Symptom 2.3: Dead Code Detection Issues
What you see:
Unused export: validateEmail in src/utils/auth.ts
But export IS used!Diagnosis:
# Check where it's used
grep -r "validateEmail" src/
# Might be dynamically imported
# Or used in way tool can't detectCommon causes:
Cause A: Dynamic Import
// Export seems unused
export function validateEmail() { ... }
// But imported dynamically
const module = await import('./auth');
module.validateEmail();Fix: Add to whitelist or comment
// Used dynamically - don't remove
export function validateEmail() { ... }Cause B: Exported for Side Effects
// Function not called, but has side effects when imported
export function setupLogging() {
configureGlobalLogger();
}
// Import triggers side effects
import './utils/logging';Fix: Rename to show side effect
// Side effect - don't remove
export function _setupLogging() { ... }Category 3: Performance Issues
Symptom 3.1: agentful Runs Very Slowly
What you see: One feature takes hours instead of minutes
Diagnosis:
# Check what's taking time
# Look for repeated operations:
# - Running tests many times
# - Reading same files repeatedly
# - Checking dead code over and overCommon causes:
Cause A: Large Codebase
1000+ files, agentful scans everything each iterationFix: Exclude directories from agent searches
# In .claude/agents/orchestrator.md
## Search Scope
Only search these directories:
- src/
- tests/
Ignore:
- node_modules/
- .next/
- build/
- dist/
- public/Cause B: Expensive Validation
Running all tests takes 10+ minutesFix: Run faster subset during development
# Quick test mode during agentful runs
npm test -- --passWithNoTests --maxWorkers=4
# Full test suite only on final validation
npm test -- --coverageCause C: Dead Code Detection on Large Projects
knip or ts-prune takes foreverFix: Disable or reduce scope
# Skip dead code check during iteration
# Only run on final validation
# In reviewer.md, comment out:
# ### 3. Dead Code DetectionSymptom 3.2: High Memory Usage
What you see: Claude Code using 2GB+ RAM, system slows down
Diagnosis: agentful reading too much into context
Fix: Reduce file reading
# In agent instructions:
## File Reading Limits
- Only read files directly related to current task
- Don't read entire directories at once
- Use Glob to find files, Read only what's needed
- Limit file size: skip files > 10KB unless necessaryOr restart Claude periodically:
# Let context flush
# Exit and restart every 20-30 iterationsCategory 4: State File Issues
Symptom 4.1: State.json Corrupted
What you see:
cat .agentful/state.json
# Parse error: Invalid JSONDiagnosis: File was edited manually or write interrupted
Fix: Restore from backup or reset
# Check git history
git log .agentful/state.json
# Restore last good version
git checkout abc123 -- .agentful/state.json
# OR reset to initial state
rm .agentful/state.json
/agentful-start # Will recreate filePrevention: Don't edit state files manually
Symptom 4.2: State Not Updating
What you see:
Feature complete, but state.json still shows "in_progress"Fix: Manual update
# Edit .agentful/completion.json
{
"features": {
"authentication": {
"status": "complete", # Change from "in_progress"
"score": 100
}
}
}Category 5: Integration Issues
Symptom 5.1: Git Conflicts with agentful
What you see:
git pull
CONFLICT (content): Merge conflict in .agentful/state.jsonDiagnosis: Multiple sources updating state files
Fix:
# Decide which state to keep
# Usually: Keep local (your work takes precedence)
git checkout --ours .agentful/state.json
git add .agentful/state.json
git commit
# Or for remote changes
git checkout --theirs .agentful/state.json
git add .agentful/state.json
git commitPrevention: Don't push state files frequently. Only on milestones.
Symptom 5.2: Environment Variables Missing
What you see:
Error: process.env.DATABASE_URL is undefinedDiagnosis: agentful trying to use env var that's not set
Fix: Add to .env.local:
DATABASE_URL="postgresql://..."
NEXT_PUBLIC_API_URL="https://..."And document in PRODUCT.md:
## Environment Variables Required
- `DATABASE_URL` - PostgreSQL connection string
- `NEXT_PUBLIC_API_URL` - API base URL
- `JWT_SECRET` - Secret for token signingCategory 6: Agent Behavior Issues
Symptom 6.1: Agent Builds Wrong Thing
What you see: agentful builds X when you asked for Y
Diagnosis: PRODUCT.md unclear or ambiguous
Example from PRODUCT.md:
### 1. User Management - CRITICAL
Users can manage their accounts.
# agentful might build:
# - Account creation
# - Profile editing
# - Account deletion
# But you wanted:
# - Login/Logout onlyFix: Be explicit about what NOT to build
### 1. User Authentication - CRITICAL
**Description**: Users can login and logout
**Acceptance Criteria**:
- [ ] Login form with email/password
- [ ] JWT token generation
- [ ] Logout functionality
- [ ] Protected routes
**Out of Scope**:
- User registration (use admin panel)
- Profile editing (feature #2)
- Account deletion (feature #3)Symptom 6.2: Agent Overwrites Manual Edits
What you see: You edit code, agentful changes it back
Diagnosis: agentful doesn't know you edited it
Fix: Document your edits
// Human-modified: Added custom error handling for edge case
// Date: 2026-01-18
// Reason: Needed to handle malformed responses from API
// Do not modify without consulting team
function handleApiResponse(response: Response) {
// Custom logic here...
}Or tell agentful in technical notes:
**Technical Notes**:
- src/app/api/handler.ts has custom error handling
- Do NOT modify the try/catch block (lines 25-40)
- Build around itSymptom 6.3: Agent Won't Stop
What you see: agentful keeps working past completion
Diagnosis: Completion criteria not met
Fix: Check what's incomplete
cat .agentful/completion.jsonMight be:
- One gate not passing (e.g., coverage at 79%)
- One checkbox not checked in PRODUCT.md
- Quality gate failing
Manual override (if truly done):
# Mark complete manually
# Edit .agentful/completion.json:
{
"overall": 100,
"features": {
"all": "complete"
}
}
# Then stop agentful
# Don't let it continue loopingEmergency Recovery Procedures
Recovery 1: Complete Reset
When everything is broken and you need to start over# 1. Backup current work
cp -r .agentful .agentful.backup
git add .
git commit -m "Backup before reset"
# 2. Remove agentful state
rm -rf .agentful/
# 3. Start fresh
/agentful-start
# agentful will re-analyze PRODUCT.md and start overWarning: You lose all progress tracking, but code remains.
Recovery 2: Rollback to Working State
When agentful broke something that worked# 1. Find last good commit
git log --oneline
# 2. Reset to that commit
git reset abc123 --hard
# 3. Remove bad state
rm -rf .agentful/
# 4. Restart from good point
/agentful-startRecovery 3: Manual Feature Completion
When agentful can't complete a feature, you need to# 1. Stop agentful
# Let it finish current task, then exit
# 2. Complete feature yourself
# Write remaining code, tests, etc.
# 3. Update completion.json
{
"features": {
"your-feature": {
"status": "complete",
"score": 100,
"completedManually": true
}
}
}
# 4. Validate
/agentful-validate
# 5. Resume agentful for next feature
/agentful-startGetting Help
When to Ask for Help
Self-solvable (use this guide):
- Validation loops
- Type errors
- Test failures
- State issues
Ask for help:
- agentful crashes Claude Code
- Data loss or corruption
- Can't diagnose after 30 minutes
- Same issue repeats after fix
How to Report Issues
Good issue report:
## agentful Issue Report
### What I was doing
Running `/agentful-start` on authentication feature
### What happened
agentful entered validation loop, stuck at 78% coverage
### Steps to reproduce
1. Run `/agentful-start`
2. Wait for authentication feature
3. Coverage stuck at 78%
### Environment
- Node.js: v20
- Framework: Next.js 14
- Database: PostgreSQL + Prisma
- Testing: Vitest
### State files
[Attach .agentful/state.json, completion.json, last-validation.json]
### PRODUCT.md
[Attach relevant feature section]
### Error logs
[Paste relevant errors]Where to report:
- GitHub Issues: https://github.com/blitz/agentful/issues
- Discord: [agentful Discord channel]
Prevention Checklist
Before starting agentful:
- PRODUCT.md is complete and specific
- Tech stack fully specified
- All features prioritized
- Acceptance criteria are testable
- Environment variables set
- Dependencies installed
- Git repository initialized
During agentful run:
- Check status every 5-10 iterations
- Monitor for decisions needing answers
- Don't interrupt mid-task
- Let validation loops run a few times
- Push code to Git periodically
When issues arise:
- Run diagnostics first
- Check state files
- Review validation output
- Try solutions from this guide
- Ask for help if stuck > 30 minutes
Summary: Troubleshooting Mindset
Effective troubleshooting:
- Diagnose first - Use quick diagnostic steps
- Find root cause - Don't just treat symptoms
- Apply targeted fix - Use the right solution
- Verify it worked - Run
/agentful-validate - Prevent recurrence - Update PRODUCT.md or config
Most common fixes:
- Run
/agentful-decidefor decisions - Add detail to PRODUCT.md for unclear requirements
- Update tests manually if they're out of sync
- Fix type errors manually (agentful struggles with complex types)
- Reset state if corrupted
When in doubt:
- Check state files
- Run validation
- Ask for help
Next Steps
Fixed your issue? Great! Now:
- Write Better PRODUCT.md - Prevent future issues
- Follow Best Practices - Avoid common pitfalls
- Review Team Adoption - If working with others
Related Guides:
- Best Practices - Prevention strategies
- Team Adoption - Team troubleshooting
- Writing PRODUCT.md - Clearer specs