Error Handling Reference
Comprehensive error handling guide for the Crypto Tax Calculator.
File Errors
CSV File Not Found
Error: Cannot find transaction CSV file
Symptoms:
Error: Transaction file not found: /path/to/trades.csv
Causes:
- Incorrect file path
- File moved or deleted
- Typo in filename
Solutions:
- Verify the file path is correct
- Use absolute path or path relative to current directory
- Check file exists:
ls -la /path/to/trades.csv
Invalid CSV Format
Error: Cannot parse CSV file
Symptoms:
Error: No headers found in trades.csv
Warning: Row 15 skipped: Cannot parse date
Causes:
- Missing header row
- Inconsistent delimiters
- Encoding issues
Solutions:
- Verify CSV has header row
- Check delimiter (comma, semicolon, tab)
- Convert to UTF-8 encoding if needed
- Open in spreadsheet app and re-export
Unknown Exchange Format
Error: Cannot auto-detect exchange format
Symptoms:
Warning: Unknown exchange format, using generic parser
Causes:
- Non-standard CSV column names
- Custom export format
Solutions:
- Specify exchange format:
--exchange coinbase - Use generic format with mapped columns
- Check
references/exchange_formats.mdfor column requirements
Data Validation Errors
Missing Required Columns
Error: CSV missing required fields
Symptoms:
Error: Missing required column: date
Error: Missing required column: quantity
Causes:
- Incomplete export from exchange
- Wrong export type selected
Solutions:
- Re-export from exchange with all fields
- Select "Transaction History" not "Account Statement"
- Manually add missing columns if data available
Invalid Date Format
Error: Cannot parse transaction date
Symptoms:
Warning: Row 15 skipped: Cannot parse date: 15/01/2025
Causes:
- Unexpected date format
- Regional date format (DD/MM vs MM/DD)
Solutions:
- Tool tries multiple formats automatically
- Standardize to ISO format: YYYY-MM-DD
- Check locale settings in export
Supported Formats:
2025-01-15(ISO)2025-01-15T10:30:00Z(ISO with time)01/15/2025(US)15/01/2025(EU - attempted)
Invalid Quantity or Price
Error: Cannot parse numeric values
Symptoms:
Warning: Row 20 skipped: Invalid quantity value
Causes:
- Text in numeric field
- Currency symbols not stripped
- Thousands separator issues
Solutions:
- Remove currency symbols ($, €)
- Use period for decimal separator
- Remove thousands separators or use consistent format
Cost Basis Errors
Insufficient Lots for Disposal
Error: Trying to sell more than available
Symptoms:
Error: Cannot dispose 1.5 BTC - only 1.0 available
Causes:
- Missing buy transactions
- Transactions not in chronological order
- Transfer not recorded as acquisition
Solutions:
- Check for missing buy transactions
- Verify all exchange imports included
- Add transfer-in as manual acquisition
- Record cost basis for transferred coins
Missing Price for Transaction
Error: Cannot calculate cost basis without price
Symptoms:
Warning: Missing price for buy on 2024-03-15, skipping lot creation
Warning: Missing price for sell on 2024-06-20, skipping disposal
Causes:
- Exchange didn't include price in export
- Historical price lookup not available
Solutions:
- Add price column manually
- Look up historical price on CoinGecko/CoinMarketCap
- Use
--verboseto see which transactions need prices
Report Generation Errors
Output File Permission Denied
Error: Cannot write output file
Symptoms:
Error: Permission denied: /path/to/report.csv
Causes:
- Directory doesn't exist
- No write permission
- File locked by another program
Solutions:
- Create output directory first
- Check directory permissions
- Close any programs using the file
Graceful Degradation
The calculator implements graceful degradation:
Full Calculation (all transactions)
│
├─► Missing price → Skip lot/disposal with warning
│ │
│ ▼
│ Continue with available data
│
├─► Unknown type → Categorize as "other"
│ │
│ ▼
│ Show warning, skip tax calculation
│
└─► Insufficient lots → Dispose available amount
│
▼
Show warning with discrepancy
Diagnostic Commands
Validate CSV File
# Check CSV structure
head -5 trades.csv
# Count rows
wc -l trades.csv
# Check for encoding issues
file trades.csv
Test Transaction Parsing
# Parse and show first 10 transactions
python transaction_parser.py trades.csv -v
Test Cost Basis Engine
# Run with verbose output
python tax_calculator.py --transactions trades.csv --verbose
Common Issues
Issue: No Transactions Found
Causes:
- Empty CSV file
- All rows failed validation
- Year filter excluded all transactions
Diagnosis:
python tax_calculator.py --transactions trades.csv --verbose
# Check for validation warnings
Issue: All Gains Are Short-Term
Causes:
- Missing acquisition dates
- Transactions all within 1 year
Diagnosis:
python tax_calculator.py --transactions trades.csv --show-lots
# Verify lot acquisition dates
Issue: Method Comparison Shows Same Results
Causes:
- Only one lot per asset
- All lots have same cost basis
Explanation: Different methods only produce different results when multiple lots exist with different cost bases.
Exchange Format Troubleshooting
Coinbase
Export: Reports → Tax documents → Transaction history CSV
Common Issues:
- "Coinbase Pro" vs "Coinbase" different formats
- "Advanced Trade" transactions need separate export
Binance
Export: Orders → Trade History → Export
Common Issues:
- No price column (requires manual price lookup)
- "Dust" conversions may be missing
Kraken
Export: History → Export
Common Issues:
- Asset symbols like "XXBT" (map to BTC)
- Multiple currencies may be included
Tax Disclaimer
IMPORTANT: This tool provides informational calculations only. It is not tax advice.
- Tax laws vary by jurisdiction
- Consult a qualified tax professional
- Keep original records for audit
- Rules change - verify current regulations