Troubleshooting Guide¶
Common Issues and Solutions¶
Installation Issues¶
Agent Not Found¶
Problem: ralph: command 'claude' not found
Solutions:
- Verify agent installation:
- Install missing agent:
- Add to PATH:
Permission Denied¶
Problem: Permission denied: './ralph'
Solution:
Execution Issues¶
Task Running Too Long¶
Problem: Ralph runs maximum iterations without achieving goals
Possible Causes:
- Unclear or overly complex task description
- Agent not making progress towards objectives
- Task scope too large for iteration limits
Solutions:
- Check iteration progress and logs:
- Break down complex tasks:
# Instead of:
Build a complete web application
# Try:
Create a Flask app with one endpoint that returns "Hello World"
- Increase iteration limits or try different agent:
Agent Timeout¶
Problem: Agent execution timed out
Solutions:
- Increase timeout:
- Reduce prompt complexity:
- Break large tasks into smaller ones
-
Remove unnecessary context
-
Check system resources:
Repeated Errors¶
Problem: Same error occurs in multiple iterations
Solutions:
- Check error pattern:
- Clear workspace and retry:
- Manual intervention:
- Fix the specific issue
- Add clarification to PROMPT.md
- Resume execution
Loop Detection Issues¶
Problem: Loop detected: XX% similarity to previous output
Ralph's loop detection triggers when agent output is ≥90% similar to any of the last 5 outputs.
Possible Causes:
- Agent is stuck on the same subtask
- Agent producing similar "working on it" messages
- API errors causing identical retry messages
- Task requires same action repeatedly (false positive)
Solutions:
- Check if it's a legitimate loop:
# Review recent outputs
ls -lt .agent/prompts/ | head -10
diff .agent/prompts/prompt_N.md .agent/prompts/prompt_N-1.md
- Improve prompt to encourage variety:
# Add explicit progress tracking
## Current Status
Document what step you're on and what has changed since last iteration.
- Break down the task:
- If agent keeps doing the same thing, the task may need restructuring
-
Split into smaller, more distinct subtasks
-
Check for underlying issues:
- API errors causing retries
- Permission issues blocking progress
- Missing dependencies
Completion Marker Not Detected¶
Problem: Ralph continues running despite TASK_COMPLETE marker
Possible Causes:
- Incorrect marker format
- Invisible characters or encoding issues
- Marker buried in code block
Solutions:
- Use exact format:
# Correct formats:
- [x] TASK_COMPLETE
[x] TASK_COMPLETE
# Incorrect (won't trigger):
- [ ] TASK_COMPLETE # Not checked
TASK_COMPLETE # No checkbox
- [x] TASK_COMPLETE # Capital X
- Check for hidden characters:
- Ensure marker is on its own line:
# Good - on its own line
- [x] TASK_COMPLETE
# Bad - inside code block
```markdown
- [x] TASK_COMPLETE # Inside code block - won't work
```
- Verify encoding:
Git Issues¶
Checkpoint Failed¶
Problem: Failed to create checkpoint
Solutions:
- Initialize Git repository:
- Check Git status:
- Fix Git configuration:
Uncommitted Changes Warning¶
Problem: Uncommitted changes detected
Solutions:
- Commit changes:
- Stash changes:
- Disable Git operations:
Context Issues¶
Context Window Exceeded¶
Problem: Context window limit exceeded
Symptoms:
- Agent forgets earlier instructions
- Incomplete responses
- Errors about missing information
Solutions:
- Reduce file sizes:
- Use more concise prompt:
- Switch to higher-context agent:
- Clear iteration history:
Performance Issues¶
Slow Execution¶
Problem: Iterations taking too long
Solutions:
- Check system resources:
- Reduce parallel operations:
- Close other applications
-
Limit background processes
-
Use faster agent:
High Memory Usage¶
Problem: Ralph consuming excessive memory
Solutions:
- Set resource limits:
- Clean old state files:
- Restart Ralph:
State and Metrics Issues¶
Corrupted State File¶
Problem: Invalid state file
Solutions:
- Remove corrupted file:
- Restore from backup:
- Reset state:
Missing Metrics¶
Problem: No metrics being collected
Solutions:
- Check metrics directory:
- Create directory if missing:
- Check permissions:
Error Messages¶
Common Error Codes¶
| Error | Meaning | Solution |
|---|---|---|
Exit code 1 |
General failure | Check logs for details |
Exit code 130 |
Interrupted (Ctrl+C) | Normal interruption |
Exit code 137 |
Killed (out of memory) | Increase memory limits |
Exit code 124 |
Timeout | Increase timeout value |
Agent-Specific Errors¶
Claude Errors¶
Solution: Add delay between iterations or upgrade API plan
Solution: Check Claude CLI configuration
Gemini Errors¶
Solution: Wait for quota reset or upgrade plan
Solution: Check Gemini CLI version and update
Q Chat Errors¶
Solution: Ensure Q service is running
Debug Mode¶
Enable Verbose Logging¶
# Maximum verbosity
ralph run --verbose
# With debug environment
DEBUG=1 ralph run
# Save logs
ralph run --verbose 2>&1 | tee debug.log
Inspect Execution¶
Trace Execution¶
# Trace system calls
strace -o trace.log ralph run
# Profile Python execution
python -m cProfile ralph_orchestrator.py
Recovery Procedures¶
From Failed State¶
- Save current state:
- Analyze failure:
- Fix issue:
- Update PROMPT.md
- Fix code errors
-
Clear problematic files
-
Resume or restart:
From Git Checkpoint¶
# List checkpoints
git log --oneline | grep checkpoint
# Reset to checkpoint
git reset --hard <commit-hash>
# Resume execution
ralph run
Getting Help¶
Self-Diagnosis¶
Run the diagnostic script:
cat > diagnose.sh << 'EOF'
#!/bin/bash
echo "Ralph Orchestrator Diagnostic"
echo "============================"
echo "Agents available:"
which claude && echo " ✓ Claude" || echo " ✗ Claude"
which gemini && echo " ✓ Gemini" || echo " ✗ Gemini"
which q && echo " ✓ Q" || echo " ✗ Q"
echo ""
echo "Git status:"
git status --short
echo ""
echo "Ralph status:"
./ralph status
echo ""
echo "Recent errors:"
grep ERROR .agent/logs/*.log 2>/dev/null | tail -5
EOF
chmod +x diagnose.sh
./diagnose.sh
Community Support¶
- GitHub Issues: Report bugs
- Discussions: Ask questions
- Discord: Join the community chat
Reporting Bugs¶
Include in bug reports:
- Ralph version:
ralph --version - Agent versions
- Error messages
- PROMPT.md content
- Diagnostic output
- Steps to reproduce
Prevention Tips¶
Best Practices¶
- Start simple: Test with basic tasks first
- Regular checkpoints: Use default 5-iteration interval
- Monitor progress: Check status frequently
- Version control: Commit before running Ralph
- Resource limits: Set appropriate limits
- Clear requirements: Write specific, testable criteria
Pre-flight Checklist¶
Before running Ralph:
- PROMPT.md is clear and specific
- Git repository is clean
- Agents are installed and working
- Sufficient disk space available
- No sensitive data in prompt
- Backup important files