Babysitter Plugin Error Codes
This document defines the standardized error code system for the babysitter plugin.
Error Code Format
All error codes follow the format: BSIT-XXXX
Code Categories
| Range | Category | Description |
|---|---|---|
| 1XXX | Installation/Setup | Errors related to installation, dependencies, and initial setup |
| 2XXX | Configuration | Errors related to configuration files and settings |
| 3XXX | Runtime/Execution | Errors that occur during task execution |
| 4XXX | State/Journal | Errors related to state management and journal files |
| 5XXX | Hook | Errors related to hook discovery and execution |
| 9XXX | Unknown/Internal | Unexpected errors and internal failures |
Installation/Setup Errors (1XXX)
BSIT-1001: Node.js Version Mismatch
Description: The installed Node.js version does not meet the minimum requirements.
Common Causes:
- Node.js is outdated
- Multiple Node.js versions installed with wrong one in PATH
- nvm/fnm using an older version
Recovery Steps:
- Check current version:
node --version - Install Node.js 18.x or later from https://nodejs.org
- If using nvm:
nvm install 18 && nvm use 18 - Verify:
node --version
Example Error Message:
[BSIT-1001] Node.js version mismatch: found v16.20.0, required >=18.0.0
BSIT-1002: jq Not Found
Description: The jq command-line JSON processor is not installed or not in PATH.
Common Causes:
- jq not installed on the system
- jq installed but not in PATH
- Conda/virtualenv environment missing jq
Recovery Steps:
- Install jq:
- macOS:
brew install jq - Ubuntu/Debian:
sudo apt-get install jq - Windows:
choco install jqorwinget install jqlang.jq
- macOS:
- Verify installation:
jq --version - Ensure jq is in your PATH
Example Error Message:
[BSIT-1002] Required dependency 'jq' not found. Install it with your package manager.
BSIT-1003: Plugin Not Installed
Description: The babysitter plugin is not properly installed or registered with Claude Code.
Common Causes:
- Plugin directory missing or moved
- Plugin not registered in Claude Code settings
- Corrupted installation
Recovery Steps:
- Verify plugin exists:
ls -la ~/.claude/plugins/babysitter - Re-register plugin:
claude plugins add babysitter - Restart Claude Code session
- Check plugin status:
claude plugins list
Example Error Message:
[BSIT-1003] Babysitter plugin not installed. Run 'claude plugins add babysitter' to install.
BSIT-1004: SDK CLI Not Found
Description: The babysitter SDK CLI (bsit or npx @a5c-ai/babysitter) is not available.
Common Causes:
- SDK package not installed
- npm global bin not in PATH
- Package installation failed
Recovery Steps:
- Install the SDK:
npm install -g @a5c-ai/babysitter - Or use npx:
npx @a5c-ai/babysitter --help - Verify PATH includes npm global bin:
npm bin -g - Add to PATH if needed
Example Error Message:
[BSIT-1004] SDK CLI not found. Install with 'npm install -g @a5c-ai/babysitter'
BSIT-1005: Git Not Available
Description: Git is not installed or not accessible in the current environment.
Common Causes:
- Git not installed
- Git not in PATH
- Restricted shell environment
Recovery Steps:
- Install git from https://git-scm.com
- Verify:
git --version - Ensure git is in your PATH
Example Error Message:
[BSIT-1005] Git is required but not found in PATH. Install git and try again.
Configuration Errors (2XXX)
BSIT-2001: Invalid Configuration
Description: The configuration file contains invalid or malformed data.
Common Causes:
- Syntax error in JSON/YAML configuration
- Invalid field values
- Missing required fields
- Unsupported configuration version
Recovery Steps:
- Validate JSON syntax:
jq . .a5c/config.json - Check for required fields in documentation
- Reset to default:
bsit config reset - Re-run configuration wizard:
bsit configure
Example Error Message:
[BSIT-2001] Invalid configuration in .a5c/config.json: unexpected token at line 15
BSIT-2002: Missing Runs Directory
Description: The .a5c/runs directory does not exist and cannot be created.
Common Causes:
- Directory was deleted
- Permission issues
- Disk full
- Read-only filesystem
Recovery Steps:
- Create manually:
mkdir -p .a5c/runs - Check permissions:
ls -la .a5c - Verify disk space:
df -h . - Check filesystem is writable
Example Error Message:
[BSIT-2002] Runs directory not found and cannot be created: .a5c/runs
BSIT-2003: Invalid Log Level
Description: The specified log level is not recognized.
Common Causes:
- Typo in log level value
- Using unsupported log level name
- Environment variable set incorrectly
Recovery Steps:
- Use valid log levels:
debug,info,warn,error,silent - Check environment:
echo $BABYSITTER_LOG_LEVEL - Update configuration with valid level
Example Error Message:
[BSIT-2003] Invalid log level 'verbose'. Valid levels: debug, info, warn, error, silent
BSIT-2004: Configuration File Not Found
Description: The expected configuration file does not exist.
Common Causes:
- First run without initialization
- Configuration file deleted
- Wrong working directory
Recovery Steps:
- Initialize configuration:
bsit init - Check working directory contains
.a5cfolder - Create default config:
bsit config reset
Example Error Message:
[BSIT-2004] Configuration file not found: .a5c/config.json
BSIT-2005: Permission Denied
Description: Cannot read or write to a required file or directory due to permissions.
Common Causes:
- File owned by different user
- Restrictive directory permissions
- SELinux/AppArmor restrictions
- Windows file locks
Recovery Steps:
- Check ownership:
ls -la <path> - Fix permissions:
chmod 755 <directory>orchmod 644 <file> - Check for file locks on Windows
- Run as appropriate user
Example Error Message:
[BSIT-2005] Permission denied: cannot write to .a5c/runs/current/state.json
Runtime/Execution Errors (3XXX)
BSIT-3001: Process Not Found
Description: The expected process file or definition could not be located.
Common Causes:
- Process name misspelled
- Process file deleted or moved
- Process not installed with plugin
- Custom process not in search path
Recovery Steps:
- List available processes:
bsit process list - Check process name spelling
- Verify process file exists in plugin/processes
- Add custom process path to configuration
Example Error Message:
[BSIT-3001] Process not found: 'tdd-quality-convergence'. Run 'bsit process list' to see available processes.
BSIT-3002: Task Execution Failed
Description: A task failed to execute successfully.
Common Causes:
- Task dependencies not met
- External command failed
- Timeout exceeded
- Resource unavailable
Recovery Steps:
- Check task logs:
bsit logs --run <run-id> --task <task-id> - Verify task dependencies are satisfied
- Increase timeout if needed
- Check external service availability
- Retry with:
bsit retry --task <task-id>
Example Error Message:
[BSIT-3002] Task execution failed: 'build-project' exited with code 1
BSIT-3003: Breakpoint Timeout
Description: A breakpoint wait exceeded the maximum allowed time.
Common Causes:
- User did not respond to breakpoint prompt
- Network issues with notification
- Claude Code session disconnected
- Timeout set too low
Recovery Steps:
- Check for pending breakpoint notifications
- Resume manually:
bsit resume --run <run-id> - Increase timeout in configuration
- Check Claude Code session is active
Example Error Message:
[BSIT-3003] Breakpoint timeout after 300s waiting for user input at 'pre-deploy-approval'
BSIT-3004: Run Already Active
Description: Attempted to start a new run while another is already active.
Common Causes:
- Previous run not properly terminated
- Concurrent babysitter invocations
- Stale lock file
Recovery Steps:
- Check active runs:
bsit status - Stop active run:
bsit stop --run <run-id> - Force stop if needed:
bsit stop --force - Remove stale lock:
rm .a5c/runs/.lock
Example Error Message:
[BSIT-3004] Run already active: run-2024-01-15-abc123. Stop it first with 'bsit stop'
BSIT-3005: Maximum Iterations Exceeded
Description: The run exceeded the maximum number of allowed iterations.
Common Causes:
- Infinite loop in process logic
- Convergence criteria not achievable
- Max iterations set too low
- Process design issue
Recovery Steps:
- Review process logic for loops
- Check convergence criteria
- Increase max iterations if appropriate
- Analyze iteration logs for patterns
Example Error Message:
[BSIT-3005] Maximum iterations (100) exceeded. Process may be in infinite loop.
BSIT-3006: Agent Communication Failed
Description: Failed to communicate with the AI agent.
Common Causes:
- API rate limiting
- Network connectivity issues
- Invalid API credentials
- Service outage
Recovery Steps:
- Check network connectivity
- Verify API credentials
- Check for rate limiting
- Retry after waiting
- Check service status page
Example Error Message:
[BSIT-3006] Agent communication failed: API returned 429 (rate limited). Retry after 60s.
State/Journal Errors (4XXX)
BSIT-4001: Journal Corrupted
Description: The run journal file is corrupted or contains invalid data.
Common Causes:
- Interrupted write operation
- Disk error
- Manual editing introduced errors
- Concurrent writes without locking
Recovery Steps:
- Check journal file:
jq . .a5c/runs/<run-id>/journal.json - Restore from backup:
cp .a5c/runs/<run-id>/journal.json.bak .a5c/runs/<run-id>/journal.json - Recreate from state:
bsit repair --run <run-id> - Start fresh run if unrecoverable
Example Error Message:
[BSIT-4001] Journal corrupted: .a5c/runs/run-abc123/journal.json - invalid JSON at offset 4521
BSIT-4002: State File Missing
Description: A required state file is missing from the run directory.
Common Causes:
- File accidentally deleted
- Incomplete run initialization
- Storage failure
- Cleanup ran prematurely
Recovery Steps:
- Check run directory:
ls -la .a5c/runs/<run-id>/ - Restore from backup if available
- Reinitialize state:
bsit init-state --run <run-id> - Start new run if state unrecoverable
Example Error Message:
[BSIT-4002] State file missing: .a5c/runs/run-abc123/state/current.json
BSIT-4003: State File Invalid
Description: The state file exists but contains invalid or inconsistent data.
Common Causes:
- Schema version mismatch
- Incomplete state update
- Manual editing errors
- Serialization bug
Recovery Steps:
- Validate state file:
bsit validate --run <run-id> - Compare with schema: Check state file against expected schema
- Reset to last checkpoint:
bsit rollback --run <run-id> - Repair state:
bsit repair --run <run-id>
Example Error Message:
[BSIT-4003] State file invalid: missing required field 'iteration' in state/current.json
BSIT-4004: Checkpoint Not Found
Description: The requested checkpoint does not exist.
Common Causes:
- Checkpoint ID incorrect
- Checkpoints not enabled
- Checkpoint was cleaned up
- No checkpoints created yet
Recovery Steps:
- List checkpoints:
bsit checkpoints --run <run-id> - Verify checkpoint ID spelling
- Check checkpoint retention settings
- Create manual checkpoint:
bsit checkpoint create
Example Error Message:
[BSIT-4004] Checkpoint not found: checkpoint-5. Available: checkpoint-1, checkpoint-2, checkpoint-3
BSIT-4005: State Lock Acquisition Failed
Description: Could not acquire lock on state files for writing.
Common Causes:
- Another process holds the lock
- Stale lock file
- Permission issues
- Lock timeout too short
Recovery Steps:
- Check for other babysitter processes:
ps aux | grep babysitter - Remove stale lock:
rm .a5c/runs/<run-id>/.lock - Wait and retry
- Increase lock timeout
Example Error Message:
[BSIT-4005] State lock acquisition failed after 30s. Lock held by PID 12345.
Hook Errors (5XXX)
BSIT-5001: Hook Not Found
Description: The specified hook file does not exist.
Common Causes:
- Hook file deleted
- Wrong hook path in configuration
- Hook type directory missing
- Case sensitivity issues
Recovery Steps:
- Check hook exists:
ls -la plugins/babysitter-unified/hooks/<hook-type>.sh - Verify hook path in configuration
- Create hook directory:
mkdir -p hooks/<hook-type> - Reinstall plugin if hooks missing
Example Error Message:
[BSIT-5001] Hook not found: hooks/on-task-complete/custom-notify.sh
BSIT-5002: Hook Not Executable
Description: The hook file exists but is not executable.
Common Causes:
- Missing execute permission
- Wrong file type (not a script)
- Windows permission issues
- Git not preserving permissions
Recovery Steps:
- Add execute permission:
chmod +x <hook-file> - On Windows, check file association
- Verify shebang line: First line should be
#!/bin/bashor similar - Git:
git update-index --chmod=+x <hook-file>
Example Error Message:
[BSIT-5002] Hook not executable: hooks/on-run-start/logger.sh. Run 'chmod +x' to fix.
BSIT-5003: Hook Execution Failed
Description: The hook script exited with a non-zero status.
Common Causes:
- Script error (syntax or runtime)
- Missing dependencies in hook
- Environment variables not set
- External service failure
Recovery Steps:
- Run hook manually to see error:
bash -x <hook-file> - Check hook logs:
cat .a5c/runs/<run-id>/hooks.log - Verify hook dependencies
- Test hook in isolation
Example Error Message:
[BSIT-5003] Hook execution failed: on-task-complete/metrics.sh exited with code 127 (command not found)
BSIT-5004: Hook Output Invalid
Description: The hook produced output that could not be parsed or was invalid.
Common Causes:
- Hook output is not valid JSON (when JSON expected)
- Output exceeds size limit
- Encoding issues
- Mixed stdout/stderr
Recovery Steps:
- Test hook output:
<hook-file> | jq . - Ensure hook outputs only JSON to stdout
- Redirect debug output to stderr
- Check output encoding is UTF-8
Example Error Message:
[BSIT-5004] Hook output invalid: on-breakpoint/cli.sh - expected JSON, got plain text
BSIT-5005: Hook Timeout
Description: The hook execution exceeded the maximum allowed time.
Common Causes:
- Hook waiting for user input
- Network request hanging
- Infinite loop in hook
- External service slow
Recovery Steps:
- Review hook for blocking operations
- Add timeouts to external calls
- Increase hook timeout in configuration
- Make hook asynchronous if possible
Example Error Message:
[BSIT-5005] Hook timeout: on-run-complete/notify.sh exceeded 30s limit
Unknown/Internal Errors (9XXX)
BSIT-9001: Unknown Error
Description: An unexpected error occurred that doesn't match any known error pattern.
Common Causes:
- Unhandled exception
- System-level failure
- Memory/resource exhaustion
- Bug in babysitter code
Recovery Steps:
- Check full error logs:
bsit logs --verbose - Check system resources (disk, memory)
- Try restarting the operation
- Report bug with logs at https://github.com/a5c-ai/babysitter/issues
Example Error Message:
[BSIT-9001] Unknown error occurred. See logs for details. Please report this issue.
BSIT-9002: Internal Error
Description: An internal error occurred in the babysitter code.
Common Causes:
- Bug in babysitter code
- Assertion failure
- Invalid internal state
- Race condition
Recovery Steps:
- Save current state/logs for bug report
- Try operation again
- Update to latest babysitter version
- Report bug with reproduction steps
Example Error Message:
[BSIT-9002] Internal error: assertion failed in StateManager.commit() - expected state to be initialized
BSIT-9003: Feature Not Implemented
Description: The requested feature is not yet implemented.
Common Causes:
- Using development/preview feature
- Feature planned for future release
- Experimental flag not enabled
Recovery Steps:
- Check documentation for feature availability
- Update to latest version
- Enable experimental features if needed
- Use alternative approach
Example Error Message:
[BSIT-9003] Feature not implemented: parallel task execution is planned for v2.0
Quick Reference Table
| Code | Name | Category |
|---|---|---|
| BSIT-1001 | Node.js Version Mismatch | Installation |
| BSIT-1002 | jq Not Found | Installation |
| BSIT-1003 | Plugin Not Installed | Installation |
| BSIT-1004 | SDK CLI Not Found | Installation |
| BSIT-1005 | Git Not Available | Installation |
| BSIT-2001 | Invalid Configuration | Configuration |
| BSIT-2002 | Missing Runs Directory | Configuration |
| BSIT-2003 | Invalid Log Level | Configuration |
| BSIT-2004 | Configuration File Not Found | Configuration |
| BSIT-2005 | Permission Denied | Configuration |
| BSIT-3001 | Process Not Found | Runtime |
| BSIT-3002 | Task Execution Failed | Runtime |
| BSIT-3003 | Breakpoint Timeout | Runtime |
| BSIT-3004 | Run Already Active | Runtime |
| BSIT-3005 | Maximum Iterations Exceeded | Runtime |
| BSIT-3006 | Agent Communication Failed | Runtime |
| BSIT-4001 | Journal Corrupted | State |
| BSIT-4002 | State File Missing | State |
| BSIT-4003 | State File Invalid | State |
| BSIT-4004 | Checkpoint Not Found | State |
| BSIT-4005 | State Lock Acquisition Failed | State |
| BSIT-5001 | Hook Not Found | Hook |
| BSIT-5002 | Hook Not Executable | Hook |
| BSIT-5003 | Hook Execution Failed | Hook |
| BSIT-5004 | Hook Output Invalid | Hook |
| BSIT-5005 | Hook Timeout | Hook |
| BSIT-9001 | Unknown Error | Internal |
| BSIT-9002 | Internal Error | Internal |
| BSIT-9003 | Feature Not Implemented | Internal |
Usage in Code
Shell Scripts
source "$PLUGIN_ROOT/scripts/error-codes.sh"
# Output an error
bsit_error "1002" "jq" "/usr/local/bin"
# Output a warning
bsit_warn "2003" "verbose" "debug, info, warn, error, silent"
# Get error message
msg=$(get_error_message "3001")
echo "Error: $msg"
# Get recovery steps
steps=$(get_recovery_steps "4001")
echo "Recovery: $steps"
JSON Error Format
When outputting errors in JSON format:
{
"error": {
"code": "BSIT-3002",
"name": "Task Execution Failed",
"message": "Task 'build-project' failed with exit code 1",
"context": {
"taskId": "task-123",
"exitCode": 1,
"duration": "45s"
},
"recovery": [
"Check task logs: bsit logs --task task-123",
"Verify dependencies are installed",
"Retry with: bsit retry --task task-123"
]
}
}
Adding New Error Codes
When adding new error codes:
- Choose the appropriate category (1XXX-9XXX)
- Use the next available number in that category
- Document: code, name, description, causes, recovery, example
- Add to error-codes.sh helper script
- Update the quick reference table
- Test error output formatting