Transport-level routing for MCP/ACP protocols
Troubleshooting
Common issues, debugging techniques, and solutions for stdio Bus workers.
Overview
This guide covers common issues encountered when working with stdio Bus workers, along with solutions and debugging techniques.
Installation Issues
Node.js Version Mismatch
Symptom: Installation fails with Node.js version error
Error message:
error @stdiobus/workers-registry@0.1.0: The engine "node" is incompatible with this module. Expected version ">=20.0.0". Got "18.0.0"
Solution:
# Check current Node.js versionnode --version# Install Node.js 20 or later# Using nvm (recommended)nvm install 20nvm use 20# Or download from nodejs.org# https://nodejs.org/
Permission Errors
Symptom: Permission denied during installation
Error message:
EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@stdiobus'
Solution:
# Option 1: Use npx (recommended)npx @stdiobus/workers-registry# Option 2: Install locally (no sudo needed)npm install @stdiobus/workers-registry# Option 3: Fix npm permissions# https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
Package Not Found
Symptom: Cannot find package
Error message:
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@stdiobus%2fworkers-registry
Solution:
# Verify package name (case-sensitive)npm install @stdiobus/workers-registry# Check npm registrynpm config get registry# Clear npm cachenpm cache clean --forcenpm install @stdiobus/workers-registry
Build Errors
Symptom: TypeScript compilation errors during installation
Solution:
# Clear node_modules and reinstallrm -rf node_modules package-lock.jsonnpm install# Verify TypeScript versionnpm list typescript# Install TypeScript if missingnpm install --save-dev typescript@5
Runtime Issues
Worker Not Starting
Symptom: Worker process fails to start
Debugging steps:
1. Check command path:
# Verify worker executable existsls -la node_modules/@stdiobus/workers-registry/out/dist/index.js# Test worker directlynode node_modules/@stdiobus/workers-registry/out/dist/index.js echo-worker
2. Check configuration:
# Validate JSON syntaxcat config.json | jq .# Check for typos in worker names# Valid: acp-worker, registry-launcher, mcp-to-acp-proxy, echo-worker, mcp-echo-server
3. Check permissions:
# Verify execute permissionschmod +x node_modules/@stdiobus/workers-registry/out/dist/index.js# Check file ownershipls -la node_modules/@stdiobus/workers-registry/out/dist/
4. Check environment:
# Verify Node.js is in PATHwhich node# Check Node.js versionnode --version# Test with absolute path/usr/local/bin/node node_modules/@stdiobus/workers-registry/out/dist/index.js echo-worker
Worker Crashes
Symptom: Worker process crashes repeatedly
Debugging steps:
1. Check stdio Bus logs:
# Docker logsdocker logs <container-name># Binary logs (if using systemd)journalctl -u stdiobus -f# Check for crash patternsdocker logs <container-name> 2>&1 | grep -i "error\|crash\|fatal"
2. Check worker stderr:
# Workers log to stderr# Look for error messages in stdio Bus logsdocker logs <container-name> 2>&1 | grep -A 5 "worker-id"
3. Increase restart limits:
{"limits": {"max_restarts": 10,"restart_window_sec": 120}}
4. Test worker standalone:
# Run worker directly to see errorsecho '{"jsonrpc":"2.0","id":"1","method":"test","params":{}}' | \node node_modules/@stdiobus/workers-registry/out/dist/index.js echo-worker
Connection Refused
Symptom: Cannot connect to stdio Bus
Error message:
Error: connect ECONNREFUSED 127.0.0.1:9000
Debugging steps:
1. Check if stdio Bus is running:
# Check processps aux | grep stdio_bus# Check Docker containerdocker ps | grep stdiobus# Check port bindingnetstat -an | grep 9000# Or on macOSlsof -i :9000
2. Verify port configuration:
# Check stdio Bus startup commanddocker logs <container-name> | grep "Listening"# Verify port is exposeddocker port <container-name>
3. Check firewall:
# Linux (iptables)sudo iptables -L -n | grep 9000# macOS (pf)sudo pfctl -s rules | grep 9000# Allow port if blockedsudo ufw allow 9000/tcp
4. Test connection:
# Test TCP connectionnc -zv localhost 9000# Test with telnettelnet localhost 9000# Send test messageecho '{"jsonrpc":"2.0","id":"1","method":"test","params":{}}' | nc localhost 9000
Session Affinity Not Working
Symptom: Messages with same sessionId go to different workers
Debugging steps:
1. Verify sessionId in requests:
# Check request formatecho '{"jsonrpc":"2.0","id":"1","method":"test","sessionId":"sess-123","params":{}}' | nc localhost 9000
2. Check worker responses:
# Verify worker preserves sessionId# Response should include: "sessionId":"sess-123"
3. Check worker instances:
{"pools": [{"id": "acp-registry","instances": 4 // Multiple instances required for session affinity}]}
4. Enable debug logging:
# Check stdio Bus logs for routing decisionsdocker logs <container-name> 2>&1 | grep -i "session"
Memory Issues
Symptom: Worker or stdio Bus running out of memory
Debugging steps:
1. Check memory usage:
# Docker container memorydocker stats <container-name># Process memoryps aux | grep stdio_busps aux | grep node
2. Adjust buffer limits:
{"limits": {"max_input_buffer": 524288, // Reduce from 1MB"max_output_queue": 2097152 // Reduce from 4MB}}
3. Reduce worker instances:
{"pools": [{"id": "acp-registry","instances": 2 // Reduce from 4}]}
4. Set Docker memory limits:
docker run --memory="512m" --memory-swap="1g" \stdiobus/stdiobus:latest
Protocol Issues
Invalid JSON Errors
Symptom: Parse errors in logs
Error message:
Parse error: Unexpected token in JSON at position 0
Debugging steps:
1. Validate JSON:
# Test JSON syntaxecho '{"jsonrpc":"2.0","id":"1","method":"test","params":{}}' | jq .# Check for extra whitespaceecho '{"test":true}' | od -c
2. Check line endings:
# NDJSON requires \n line endings# Verify with hexdumpecho '{"test":true}' | hexdump -C
3. Test with simple message:
# Minimal valid messageecho '{"jsonrpc":"2.0","id":"1","method":"test","params":{}}' | nc localhost 9000
Missing Required Fields
Symptom: JSON-RPC validation errors
Error message:
Error: Missing required field: jsonrpc
Solution:
# Valid JSON-RPC 2.0 request must include:# - jsonrpc: "2.0"# - id: string or number (for requests)# - method: string# - params: object (optional)# Correct format:echo '{"jsonrpc":"2.0","id":"1","method":"test","params":{}}' | nc localhost 9000# Incorrect (missing jsonrpc):echo '{"id":"1","method":"test","params":{}}' | nc localhost 9000
Timeout Errors
Symptom: Requests timeout without response
Debugging steps:
1. Check worker is processing:
# Look for worker activity in logsdocker logs <container-name> 2>&1 | tail -f
2. Increase timeouts:
{"limits": {"backpressure_timeout_sec": 120, // Increase from 60"drain_timeout_sec": 60 // Increase from 30}}
3. Check for backpressure:
# Look for backpressure warnings in logsdocker logs <container-name> 2>&1 | grep -i "backpressure\|queue full"
4. Test with simple worker:
# Use echo worker to isolate issue# If echo worker works, issue is with specific worker implementation
Debugging Commands
Check stdio Bus Status
# Docker container statusdocker ps -a | grep stdiobus# Container logsdocker logs <container-name># Follow logs in real-timedocker logs -f <container-name># Last 100 linesdocker logs --tail 100 <container-name># Logs with timestampsdocker logs -t <container-name>
Check Worker Status
# List worker processesps aux | grep node# Check worker stderr outputdocker logs <container-name> 2>&1 | grep "worker-id"# Test worker directlyecho '{"jsonrpc":"2.0","id":"1","method":"test","params":{}}' | \node node_modules/@stdiobus/workers-registry/out/dist/index.js echo-worker
Network Debugging
# Check port bindingnetstat -an | grep 9000lsof -i :9000# Test TCP connectionnc -zv localhost 9000telnet localhost 9000# Capture network traffictcpdump -i lo -A port 9000# Test with curl (HTTP-like)curl -X POST http://localhost:9000 \-H "Content-Type: application/json" \-d '{"jsonrpc":"2.0","id":"1","method":"test","params":{}}'
Configuration Validation
# Validate JSON syntaxcat config.json | jq .# Check for common issuesjq '.pools[] | select(.instances < 1)' config.json # Invalid instancesjq '.pools[] | select(.command == null)' config.json # Missing command# Pretty print configurationjq . config.json
Performance Monitoring
# Docker statsdocker stats <container-name># Process CPU and memorytop -p $(pgrep stdio_bus)# Network connectionsnetstat -an | grep 9000 | wc -l# Open file descriptorslsof -p $(pgrep stdio_bus) | wc -l
Error Codes
stdio Bus Error Codes
| Code | Message | Description | Solution |
|---|---|---|---|
| 1 | Configuration error | Invalid configuration file | Validate JSON syntax and required fields |
| 2 | Worker spawn error | Failed to start worker process | Check command path and permissions |
| 3 | Port binding error | Cannot bind to specified port | Check if port is already in use |
| 4 | Worker crash | Worker process crashed | Check worker logs for errors |
| 5 | Restart limit exceeded | Worker restarted too many times | Increase restart limits or fix worker issue |
JSON-RPC Error Codes
| Code | Message | Description | Solution |
|---|---|---|---|
| -32700 | Parse error | Invalid JSON | Validate JSON syntax |
| -32600 | Invalid Request | Missing required fields | Include jsonrpc, id, method |
| -32601 | Method not found | Unknown method | Check method name spelling |
| -32602 | Invalid params | Invalid parameters | Validate parameter types and values |
| -32603 | Internal error | Worker internal error | Check worker logs |
Worker-Specific Error Codes
| Code | Message | Description | Solution |
|---|---|---|---|
| -32000 | Server error | Generic worker error | Check worker logs for details |
| -32001 | Session not found | Invalid session ID | Create new session or check session ID |
| -32002 | Agent not found | Invalid agent ID | Check agent ID spelling and availability |
| -32003 | Tool not found | Invalid tool name | List available tools first |
| -32004 | Tool execution error | Tool execution failed | Check tool parameters and logs |
Common Error Messages
Command not found
Error:
Error: spawn node ENOENT
Solution:
# Add Node.js to PATHexport PATH="/usr/local/bin:$PATH"# Or use absolute path in configuration{"pools": [{"command": "/usr/local/bin/node","args": ["..."]}]}
Address already in use
Error:
Error: listen EADDRINUSE: address already in use 0.0.0.0:9000
Solution:
# Find process using portlsof -i :9000# Kill processkill -9 <PID># Or use different port./stdio_bus --config config.json --tcp 0.0.0.0:9001
Too many open files
Error:
Error: EMFILE: too many open files
Solution:
# Check current limitulimit -n# Increase limit (temporary)ulimit -n 4096# Increase limit (permanent)# Add to /etc/security/limits.conf:* soft nofile 4096* hard nofile 8192
Worker restart limit exceeded
Error:
Error: Worker restart limit exceeded for pool 'acp-worker'
Solution:
{"limits": {"max_restarts": 10, // Increase from 5"restart_window_sec": 120 // Increase from 60}}
Getting Help
Before Asking for Help
1. Check logs:
- stdio Bus logs:
docker logs <container-name> - Worker stderr output
- System logs
2. Verify configuration:
- JSON syntax is valid
- Worker names are correct
- Paths are correct
3. Test with echo worker:
- Isolate issue to specific worker or stdio Bus
4. Check versions:
- Node.js version:
node --version - Package version:
npm list @stdiobus/workers-registry - stdio Bus version:
docker inspect stdiobus/stdiobus:latest
Reporting Issues
When reporting issues, include:
1. Environment:
- Operating system and version
- Node.js version
- Package version
- stdio Bus version
2. Configuration:
- stdio Bus configuration file
- Worker configuration
- Environment variables
3. Logs:
- stdio Bus logs
- Worker stderr output
- Error messages
4. Steps to reproduce:
- Exact commands run
- Expected behavior
- Actual behavior
Support Channels
- GitHub Issues: github.com/stdiobus/workers-registry/issues
- GitHub Discussions: github.com/stdiobus/workers-registry/discussions
- Documentation: stdiobus.com
Next Steps
- Configuration - Review configuration options
- Integration - Integration patterns and examples
- API Reference - Complete API documentation
- Installation - Installation guide