# Troubleshooting Guide

## Sync Errors

### API Key Configuration

The app requires a valid API key to sync data from the SBA Major Domo API.

**Option 1: Settings Screen (Recommended)**
1. Launch the app: `sba-scout`
2. Press `x` to open Settings
3. Enter your API key
4. Click "Save Settings"

**Option 2: Edit settings.yaml directly**
1. Edit `data/settings.yaml`
2. Set `api.api_key` to your actual API key
3. Save the file
4. Restart the app

### Viewing Logs

All errors are now logged to `data/logs/sba_scout.log` instead of the terminal.

To view recent errors:
```bash
tail -f data/logs/sba_scout.log
```

To search for specific errors:
```bash
grep "ERROR" data/logs/sba_scout.log
```

### Common Errors

**"API key not configured"**
- Your API key is missing or set to the placeholder value
- Fix: Configure your API key using one of the methods above

**"Sync failed: Invalid API key"** (401/403 error)
- Your API key is invalid or expired
- Fix: Get a new API key from the SBA Major Domo system

**"Sync failed: API error 500"**
- The API server is experiencing issues
- Fix: Wait a few minutes and try again

**"Request failed: Connection timeout"**
- Network connectivity issues
- Fix: Check your internet connection, or increase timeout in settings

## Getting an API Key

To get an API key for the SBA Major Domo API:
1. Visit the SBA Major Domo system
2. Go to your account settings
3. Generate a new API key
4. Copy the key and paste it into the app settings

## Need More Help?

Check the full logs at `data/logs/sba_scout.log` for detailed error messages and stack traces.
