rustchain-community 1.0.0

Open-source AI agent framework with core functionality and plugin system
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# đŸ› ī¸ RustChain Error Handling Guide

*Complete guide to understanding and resolving RustChain errors*

## 📋 Table of Contents

- [Understanding Error Messages]#understanding-error-messages
- [Common Error Categories]#common-error-categories
- [Troubleshooting Workflow]#troubleshooting-workflow
- [Error Recovery Strategies]#error-recovery-strategies
- [Prevention Best Practices]#prevention-best-practices

## 🔍 Understanding Error Messages

RustChain provides enhanced error messages with:

- **đŸŽ¯ Clear Title**: What went wrong
- **📝 Description**: Detailed explanation
- **📋 Context**: Additional relevant information
- **💡 Suggestions**: Actionable steps to fix the problem
- **🔧 Help Commands**: Specific commands to diagnose or resolve

### Error Message Format

```
🔧 Configuration Missing
Required configuration key 'api_key' is not set.

📋 Context:
RustChain needs this configuration to operate properly.

💡 Suggestions:
  â€ĸ Add 'api_key' to your configuration file
  â€ĸ Set environment variable: export RUSTCHAIN_API_KEY
  â€ĸ Run 'rustchain config init' to create default configuration
  â€ĸ Check documentation: docs/CONFIGURATION.md

🔧 Try this command:
  rustchain config show | grep api_key
```

## đŸ—‚ī¸ Common Error Categories

### Configuration Errors

#### Missing API Keys
**Problem**: LLM provider API keys not configured
```bash
# Error
🔐 AI Authentication Failed
OpenAI authentication failed.

# Solutions
export OPENAI_API_KEY="your-api-key-here"
rustchain config init
rustchain llm test openai
```

#### Invalid Configuration Format
**Problem**: YAML/TOML syntax errors in config files
```bash
# Error
📝 Configuration Parse Error
Configuration file has syntax errors.

# Solutions
# Check indentation (use spaces, not tabs)
# Validate with online YAML/JSON validator
rustchain config validate
```

#### Missing Configuration Files
**Problem**: Configuration files not found
```bash
# Error
📄 Configuration File Missing
Configuration file not found: /path/to/config.yaml

# Solutions
rustchain config init
# Check file path and permissions
ls -la rustchain.toml
```

### Mission Execution Errors

#### Mission File Not Found
**Problem**: Mission YAML file doesn't exist or isn't accessible
```bash
# Error
🚀 Mission Not Found
Mission 'nonexistent.yaml' not found.

# Solutions
ls examples/                    # List available missions
rustchain mission list          # Show all missions
pwd                            # Check current directory
```

#### Mission Step Failures
**Problem**: Individual mission steps fail during execution
```bash
# Error
❌ Mission Step Failed
Step 'llm_call' failed in mission 'analysis'.

# Solutions
rustchain mission validate mission.yaml  # Validate before running
rustchain run mission.yaml --dry-run     # Test without execution
rustchain safety validate mission.yaml   # Check safety
```

#### Dependency Cycles
**Problem**: Circular dependencies between mission steps
```bash
# Error
🔄 Dependency Cycle Detected
Circular dependency in mission 'complex_analysis'.

# Solutions
# Review 'depends_on' fields in mission YAML
# Create linear dependency chain
rustchain mission validate mission.yaml
```

### Tool and LLM Errors

#### Tool Not Found
**Problem**: Requested tool doesn't exist or isn't enabled
```bash
# Error
🔧 Tool Not Found
Tool 'custom_analyzer' is not available.

# Solutions
rustchain tools list           # See available tools
rustchain features list        # Check enabled features
# Enable required features: --features tools
```

#### LLM Service Unavailable
**Problem**: AI provider service is down or unreachable
```bash
# Error
🤖 AI Service Unavailable
OpenAI service is currently unavailable.

# Solutions
curl https://api.openai.com/v1/models  # Test connectivity
rustchain llm test                     # Test all providers
# Try different provider or wait and retry
```

#### Rate Limit Exceeded
**Problem**: Too many API requests to LLM provider
```bash
# Error
đŸšĻ Rate Limit Exceeded
OpenAI rate limit exceeded.

# Solutions
# Wait before retrying (usually 60 seconds)
# Upgrade API plan for higher limits
# Use different provider temporarily
rustchain llm models --provider anthropic
```

### Security and Safety Errors

#### Policy Violations
**Problem**: Operation blocked by security policies
```bash
# Error
đŸ›Ąī¸ Security Violation
Security policy violation detected.

# Solutions
rustchain policy status        # Check active policies
rustchain safety validate mission.yaml
# Review operation for security implications
```

#### Safety Validation Failures
**Problem**: Mission contains potentially unsafe operations
```bash
# Error
âš ī¸ Mission has safety concerns:
🔴 Critical: File system access outside sandbox
🟡 Warning: Network access to external services

# Solutions
# Review mission steps for security risks
# Use --skip-safety flag only for trusted missions
rustchain safety validate mission.yaml --strict
```

### System and Resource Errors

#### Memory Exhausted
**Problem**: System running out of memory
```bash
# Error
đŸ’ģ System Resources Exhausted
System resource 'memory' exhausted.

# Solutions
# Free up system memory
# Reduce mission complexity
# Increase system memory limits
# Run fewer concurrent operations
```

#### File Permission Errors
**Problem**: Insufficient permissions to access files
```bash
# Error
đŸšĢ Permission Denied
Tool 'file_reader' access denied.

# Solutions
chmod +r filename              # Make file readable
ls -la filename               # Check permissions
# Run with appropriate user privileges
rustchain policy status       # Check access policies
```

## 🔄 Troubleshooting Workflow

### Step 1: Identify Error Type
Look at the error icon and title to understand the category:
- 🔧 Configuration issues
- 🚀 Mission problems
- 🤖 LLM/AI issues
- 🔧 Tool problems
- đŸ›Ąī¸ Security concerns
- đŸ’ģ System resources

### Step 2: Read Context and Suggestions
Always read the full error message:
- **Context**: Understand why the error occurred
- **Suggestions**: Follow the recommended actions
- **Help Command**: Run the suggested diagnostic command

### Step 3: Apply Systematic Fixes
1. **Quick Fixes**: Try the first 1-2 suggestions
2. **Validation**: Use built-in validation commands
3. **Testing**: Test with simpler scenarios first
4. **Documentation**: Check relevant documentation

### Step 4: Escalate if Needed
If basic troubleshooting doesn't work:
1. Run diagnostic commands
2. Check system logs
3. Search documentation and discussions
4. Report issue with full error details

## đŸ›Ąī¸ Error Recovery Strategies

### Configuration Recovery
```bash
# Backup current config
cp rustchain.toml rustchain.toml.backup

# Reset to defaults
rustchain config init

# Validate and test
rustchain config validate
rustchain llm test
```

### Mission Recovery
```bash
# Validate mission structure
rustchain mission validate mission.yaml

# Test with dry run
rustchain run mission.yaml --dry-run

# Check safety
rustchain safety validate mission.yaml

# Execute with caution
rustchain run mission.yaml
```

### System Recovery
```bash
# Check system resources
df -h                          # Disk space
free -h                        # Memory
ps aux | grep rustchain       # Processes

# Clean up if needed
rustchain audit export --output cleanup.json
# Review and clean old data
```

## ✅ Prevention Best Practices

### 1. Configuration Management
- Use version control for configuration files
- Validate configs before deployment
- Keep API keys secure and rotated
- Document configuration changes

```bash
# Good practices
rustchain config validate      # Always validate
git add rustchain.toml        # Version control
rustchain config show         # Review settings
```

### 2. Mission Development
- Start with simple missions
- Use dry-run mode for testing
- Validate before execution
- Handle dependencies carefully

```bash
# Mission development workflow
rustchain mission validate mission.yaml
rustchain run mission.yaml --dry-run
rustchain safety validate mission.yaml
rustchain run mission.yaml
```

### 3. Error Monitoring
- Enable audit logging
- Monitor system resources
- Review error patterns
- Set up alerts for critical issues

```bash
# Monitoring commands
rustchain audit stats         # Review error patterns
rustchain build status        # System health
rustchain policy status       # Security compliance
```

### 4. Dependency Management
- Keep RustChain updated
- Verify tool dependencies
- Test after updates
- Maintain backup configurations

```bash
# Dependency checks
rustchain --version           # Check version
rustchain features list       # Verify features
rustchain tools list          # Check available tools
```

## 🔧 Advanced Debugging

### Debug Mode
Enable verbose logging for detailed error information:
```bash
export RUST_LOG=debug
rustchain run mission.yaml

# Or for specific components
export RUST_LOG=rustchain::core::executor=debug
```

### System Diagnostics
```bash
# Comprehensive system check
rustchain build dashboard      # Overall health
rustchain features summary     # Feature status
rustchain audit verify        # Audit integrity
rustchain policy validate     # Policy health
```

### Performance Debugging
```bash
# Profile mission execution
time rustchain run mission.yaml

# Memory usage monitoring
/usr/bin/time -v rustchain run mission.yaml

# System resource monitoring
rustchain build status
```

## 📞 Getting Help

### Self-Service Resources
1. **Built-in Help**: `rustchain <command> --help`
2. **Documentation**: Check docs/ directory
3. **Examples**: Review examples/ directory
4. **Diagnostics**: Use built-in diagnostic commands

### Community Support
1. **GitHub Discussions**: Ask questions and share solutions
2. **Issue Tracker**: Report bugs with full error details
3. **Documentation**: Contribute improvements
4. **Examples**: Share working mission examples

### Error Reporting
When reporting errors, include:
- Full error message (with colors/formatting)
- Command that caused the error
- System information (`rustchain --version`)
- Configuration details (sanitized)
- Steps to reproduce

```bash
# Collect diagnostic info
rustchain --version
rustchain features list
rustchain config show  # Remove sensitive data
rustchain build status
```

## 📚 Error Message Reference

### Icons and Meanings
- 🔧 **Configuration**: Setup and settings issues
- 🚀 **Mission**: Mission file or execution problems
- 🤖 **AI/LLM**: AI provider or model issues
- 🔧 **Tools**: Tool execution or availability
- đŸ›Ąī¸ **Security**: Safety and policy violations
- đŸ’ģ **System**: Resource or infrastructure problems
- ⚡ **Execution**: Runtime or process errors
- 📄 **File**: File system or IO operations
- 🌐 **Network**: Connectivity or API issues
- ❓ **Unknown**: Unexpected or uncategorized errors

### Severity Levels
- 🚨 **Critical**: System cannot continue
- ❌ **Error**: Operation failed
- âš ī¸ **Warning**: Issue detected but operation continues
- â„šī¸ **Info**: Informational message

---

*This guide covers the most common RustChain errors and their solutions. For specific issues not covered here, check the API documentation or community discussions.*