Troubleshooting
This guide explains how undatum handles errors and provides troubleshooting tips for common issues.
Overview
undatum provides user-friendly error messages instead of raw Python tracebacks. All errors are categorized and include actionable guidance to help you resolve issues quickly.
Error Categories
Exit Code 1: User Errors
Errors caused by invalid input or user mistakes:
- File not found
- Invalid file format
- Missing required parameters
- Invalid field names
- Query syntax errors
Exit Code 2: Configuration Errors
Errors related to configuration or dependencies:
- Missing optional dependencies
- Invalid configuration files
- Missing environment variables
Exit Code 3: System Errors
Errors related to system resources or permissions:
- Permission denied
- Database connection errors
- Network errors
Exit Code 4: Internal Errors
Unexpected errors that may indicate a bug:
- Unhandled exceptions
- Internal processing errors
Common Error Messages
File Not Found
Error:
Error: File not found: '/path/to/data.csv'
Did you mean: '/path/to/data2.csv'?
Check that the file path is correct and the file exists.
Solutions:
- Verify the file path is correct
- Check for typos in the filename
- Use absolute paths if relative paths don't work
- Ensure the file exists in the specified location
Example:
# Wrong
undatum convert data.cvs output.jsonl
# Correct (if typo detected, undatum suggests the correct file)
undatum convert data.csv output.jsonl
Permission Denied
Error:
Error: Permission denied: Cannot read '/path/to/data.csv'
Fix: chmod +r /path/to/data.csv
Or check file ownership and permissions.
Solutions:
- Check file permissions:
ls -l /path/to/data.csv - Add read permission:
chmod +r /path/to/data.csv - Add write permission (for output files):
chmod +w /path/to/output.csv - Check file ownership if you don't have permission to modify
Example:
# Fix read permission
chmod +r data.csv
undatum convert data.csv output.jsonl
# Fix write permission for output
chmod +w output.jsonl
Unsupported File Format
Error:
Error: Unsupported file format: 'xyz'
Supported formats: csv, jsonl, parquet, avro, orc, xml, xls, xlsx, bson
Use 'undatum convert' to convert to a supported format.
Solutions:
- Convert the file to a supported format first
- Check the file extension matches the actual format
- Use
--format-into explicitly specify the format
Example:
# Convert unsupported format to CSV first
undatum convert input.xyz output.csv --format-in csv
Missing Required Parameter
Error:
Error: Invalid input: Missing required parameter 'fields'
The 'fields' option is required for this operation.
Solutions:
- Check command documentation:
undatum <command> --help - Provide all required parameters
- Verify parameter names are correct
Example:
# Wrong - missing --fields
undatum select data.csv
# Correct
undatum select data.csv --fields name,email
Invalid Field Name
Error:
Error: Invalid parameter 'field_name': Field does not exist
Did you mean: 'field_name2'?
Valid options: field1, field2, field3
Solutions:
- Check available fields:
undatum headers data.csv - Use the suggested field name if a typo is detected
- Verify field names match exactly (case-sensitive)
Example:
# Check available fields first
undatum headers data.csv
# Use correct field name
undatum select data.csv --fields email,phone
Missing Dependency
Error:
Error: Missing dependency: 'package_name'
This feature requires 'package_name'. Install it with:
pip install package_name
Solutions:
- Install the required dependency
- Use the suggested installation command
- For optional features, install extras:
pip install undatum[api]
Example:
# Install missing dependency
pip install pyyaml
# Or install with extras
pip install "undatum[api]"
Database Connection Error
Error:
Error: Database error: Connection failed
postgresql error: Could not connect to database
Check connection URI and database server status.
Solutions:
- Verify the database server is running
- Check connection URI format
- Verify credentials are correct
- Check network connectivity
- Ensure database exists
Example:
# Verify connection string format
undatum db load data.csv "postgresql://user:password@host:5432/dbname"
Verbose Mode
For detailed error information including full tracebacks, use the --verbose flag:
undatum convert data.csv output.jsonl --verbose
This is useful for:
- Debugging internal errors
- Reporting bugs
- Understanding the full error context
Error Message Features
Typo Detection
undatum automatically detects typos in file paths and field names:
# Typo in filename - undatum suggests corrections
undatum convert data.cvs output.jsonl
# Error: File not found: 'data.cvs'
# Did you mean: 'data.csv'?
Actionable Guidance
All error messages include specific steps to resolve the issue:
- Permission errors include
chmodcommands - Format errors list supported formats
- Dependency errors include installation commands
- Field errors suggest valid alternatives
Consistent Formatting
All errors follow a consistent format:
Error: <Error type>: <Description>
<Actionable guidance>
Troubleshooting Tips
1. Check File Paths
Always verify file paths are correct:
ls -la /path/to/file.csv
2. Verify Permissions
Check file permissions before running commands:
ls -l data.csv
chmod +r data.csv # If needed
3. Use Verbose Mode
For detailed error information:
undatum <command> --verbose
4. Check Command Syntax
Review command help for correct usage:
undatum <command> --help
5. Verify Dependencies
Install required dependencies:
pip install undatum[api] # For API features
pip install pyyaml # For YAML support
Reporting Errors
When reporting errors, include:
- Full error message (use
--verboseflag) - Command that caused the error
- Input file format and size
- Python version:
python --version - undatum version:
undatum --version
Error Handling in Scripts
When using undatum in scripts, check exit codes:
#!/bin/bash
if undatum convert data.csv output.jsonl; then
echo "Conversion successful"
else
exit_code=$?
case $exit_code in
1) echo "User error - check input" ;;
2) echo "Configuration error - check dependencies" ;;
3) echo "System error - check permissions" ;;
4) echo "Internal error - report bug" ;;
esac
exit $exit_code
fi
Best Practices
- Validate inputs early: Check file existence and permissions before processing
- Use absolute paths: Avoid path resolution issues
- Check dependencies: Install required packages before use
- Read error messages: They contain actionable guidance
- Use verbose mode: For debugging and bug reports
Related Documentation
- Installation - Install and extras
- Quick start - First commands
- Developer Error Handling Patterns - For contributors
AI provider troubleshooting
Common Issues
Provider not found:
# Error: No AI provider specified
# Solution: Set environment variable or use --ai-provider
export UNDATUM_AI_PROVIDER=openai
# or
undatum analyze data.csv --autodoc --ai-provider openai
API key not found:
# Error: API key is required
# Solution: Set provider-specific API key
export OPENAI_API_KEY=sk-...
export OPENROUTER_API_KEY=sk-or-...
export PERPLEXITY_API_KEY=pplx-...
# ai doc / ai filter (iterabledata) may also use:
export ANTHROPIC_API_KEY=sk-ant-...
export GEMINI_API_KEY=...
export AZURE_OPENAI_API_KEY=...
Ollama connection failed:
# Error: Connection refused
# Solution: Ensure Ollama is running and model is pulled
ollama serve
ollama pull llama3.2
# Or specify custom URL
export OLLAMA_BASE_URL=http://localhost:11434
LM Studio connection failed:
# Error: Connection refused
# Solution: Start LM Studio server and load a model
# In LM Studio: Start Server, then:
export LMSTUDIO_BASE_URL=http://localhost:1234/v1
Structured output errors:
- All providers now use JSON Schema for reliable parsing
- If a provider doesn't support structured output, it will fall back gracefully
- Check provider documentation for model compatibility
Provider-Specific Notes
Legacy --autodoc (analyze, schema, schema-bulk, doc): openai, openrouter, ollama, lmstudio, perplexity only.
ai * subcommands (iterabledata):
- OpenAI: Requires API key; models include
gpt-4o-mini,gpt-4o,gpt-3.5-turbo - Anthropic: Requires
ANTHROPIC_API_KEY; models include Claude 3.5/3 Haiku and Sonnet families - Gemini: Requires
GEMINI_API_KEY; models includegemini-2.0-flashand Pro variants - Azure OpenAI: Requires
AZURE_OPENAI_API_KEYandAZURE_OPENAI_ENDPOINT - OpenRouter: Unified API for hosted models from OpenAI, Anthropic, Google, Meta, and others
- Ollama: Local models, no API key; requires Ollama installed and running
- LM Studio: Local models via OpenAI-compatible API; requires LM Studio server running
- Perplexity: Requires API key; uses
sonarmodel by default