Skip to content

Troubleshooting

Common issues and solutions for the trading system.


Quick Diagnostics

# Check all LaunchAgents
launchctl list | grep -E "micro-cap|bert"

# Check recent errors
tail -50 /tmp/micro_cap_monitor_error.log

# Test Alpaca connection
cd /Users/bertfrichot/Development/bert-trading-personal
uv run python3 -c "
from alpaca.trading.client import TradingClient
import os
from dotenv import load_dotenv
load_dotenv()
client = TradingClient(os.getenv('ALPACA_PAPER_API_KEY'), os.getenv('ALPACA_PAPER_SECRET_KEY'), paper=True)
print(f'Account: {client.get_account().equity}')
"

Common Issues

LaunchAgent Exit Code 127

Cause: Script or module not found

Fix:

# Verify script exists
ls -la /Users/bertfrichot/Development/bert-trading-personal/tools/micro_cap_paper_trader.py

# Check Python path
which python3
which uv

"No module named X"

Cause: Missing dependency

Fix:

cd /Users/bertfrichot/Development/bert-trading-personal
uv add <missing-module>
uv sync

Alpaca API 401 Unauthorized

Cause: Invalid or missing API keys

Fix: 1. Check .env file exists and has correct keys 2. Verify keys in Alpaca dashboard 3. Regenerate if needed

Schwab 401 Unauthorized

Cause: OAuth tokens expired

Fix:

uv run python3 tools/schwab_setup.py

"possibly delisted; no timezone found"

Cause: Symbol no longer valid or yfinance issue

Fix: - Remove symbol from watchlist - Or wait and retry (temporary yfinance issue)

Market Data Stale

Cause: yfinance rate limiting or API issue

Fix:

# Test yfinance directly
uv run python3 -c "import yfinance as yf; print(yf.Ticker('AAPL').info['regularMarketPrice'])"


Log Locations

Log Location
Paper Trader /tmp/micro_cap_paper_trader.log
Monitor /tmp/micro_cap_monitor.log
Monitor Errors /tmp/micro_cap_monitor_error.log

Reset Procedures

Full System Reset

# Stop all agents
launchctl unload ~/Library/LaunchAgents/com.bert.micro-cap-paper-trader.plist
launchctl unload ~/Library/LaunchAgents/com.bert.micro-cap-monitor.plist

# Clear logs
rm /tmp/micro_cap_*.log

# Reload agents
launchctl load ~/Library/LaunchAgents/com.bert.micro-cap-paper-trader.plist
launchctl load ~/Library/LaunchAgents/com.bert.micro-cap-monitor.plist

Last Updated: January 2026