Transport-level routing for MCP/ACP protocols
We appreciate your patience. The service is temporarily operating in an external runtime environment.
Transport-level routing for MCP/ACP protocols
We appreciate your patience. The service is temporarily operating in an external runtime environment.
Common issues, debugging techniques, and solutions for stdio Bus workers.
This guide covers common issues encountered when working with stdio Bus workers, along with solutions and debugging techniques.
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/
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
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
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
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
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
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
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"
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
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
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
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
# 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>
# 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
# 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":{}}'
# 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
# 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
| 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 |
| 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 |
| 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 |
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": ["..."]}]}
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
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
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}}
1. Check logs:
docker logs <container-name>2. Verify configuration:
3. Test with echo worker:
4. Check versions:
node --versionnpm list @stdiobus/workers-registrydocker inspect stdiobus/stdiobus:latestWhen reporting issues, include:
1. Environment:
2. Configuration:
3. Logs:
4. Steps to reproduce: