Troubleshooting
This guide covers common issues you might encounter while using Emma and how to resolve them.
Connection issues
Cannot connect to Infrahub
Symptoms:
- Emma shows "Connection Failed" status
- API calls timeout or fail
- Cannot load schemas or data
Solutions:
-
Check Infrahub Address
# Verify the address is correct and accessible
curl http://localhost:8000/api/schema/ -
Verify API Token
- Ensure the token is valid and not expired
- Check token permissions in Infrahub
- Try generating a new token
-
Network Connectivity
- Check if Infrahub is running:
docker ps
or service status - Verify port accessibility:
telnet localhost 8000
- Check firewall rules and network configuration
- Check if Infrahub is running:
-
Docker Network Issues (when using containers)
# Check if containers can communicate
docker network ls
docker network inspect <network-name>
# Connect Emma to Infrahub network
docker network connect <infrahub-network> emma-emma-1
Authentication errors
Error: "Unauthorized" or "403 Forbidden"
Solutions:
-
Verify
INFRAHUB_API_TOKEN
is set correctly -
Check token permissions in Infrahub admin interface
-
Ensure token hasn't expired
-
Try accessing Infrahub directly with the token:
curl -H "X-INFRAHUB-KEY: your-token" http://localhost:8000/api/schema/
Schema issues
Schema loading failures
Error: "Failed to load schema" or validation errors
Common Causes and Solutions:
-
Missing Dependencies
- Load base schemas before dependent schemas
- Check inheritance chain requirements
- Verify referenced schemas exist
-
Invalid YAML Syntax
- Use a YAML validator to check syntax
- Check indentation (use spaces, not tabs)
- Verify quotes and special characters
-
Schema Conflicts
- Check for naming conflicts with existing schemas
- Verify namespace uniqueness
- Review attribute naming conventions
-
Permission Issues
- Ensure API token has schema modification permissions
- Check branch permissions if using feature branches
AI schema builder issues
Problem: AI generates incorrect or incomplete schemas
Solutions:
-
Improve Descriptions
- Be more specific about requirements
- Include examples of desired attributes
- Mention relationships explicitly
- Reference existing schemas
-
Check OpenAI Configuration
- Verify API key is valid and has credits
- Check rate limits and quotas
- Try a simpler description first
-
Validate Generated Schemas
- Always review AI output carefully
- Test schemas with sample data
- Compare with similar schemas in the library
Data import/export issues
Import failures
Common Problems:
-
File Format Issues
Error: "Unable to parse CSV file"
Solutions:
- Ensure file is UTF-8 encoded
- Check for proper CSV format with headers
- Remove or escape special characters
- Verify file size is under 100MB
-
Mapping Errors
Error: "Column 'xyz' cannot be mapped to attribute 'abc'"
Solutions:
- Check attribute names match schema definition
- Verify data types are compatible
- Review required vs optional fields
- Check relationship target schemas exist
-
Validation Failures
Error: "Validation failed for record 123"
Solutions:
- Check data format (dates, IPs, emails)
- Verify enum values are valid
- Ensure required fields are populated
- Check uniqueness constraints
-
Relationship Resolution
Error: "Cannot resolve relationship to 'Location'"
Solutions:
- Ensure referenced objects exist in Infrahub
- Check relationship field naming
- Verify object identifiers are correct
- Create referenced objects first
Export failures
Common Problems:
-
Permission Errors
- Verify read permissions for target schemas
- Check branch access permissions
- Ensure API token has export rights
-
Performance Issues
- Reduce export size with filters
- Export in smaller batches
- Check Infrahub resource usage
- Increase timeout settings
-
Format Issues
- Verify encoding settings
- Check delimiter configuration
- Review special character handling
Performance issues
Slow response times
Symptoms:
- Long loading times for schemas or data
- Timeouts during operations
- Unresponsive interface
Solutions:
-
Check System Resources
# Monitor system resources
htop # or top
docker stats # for containerized deployments -
Optimize Operations
- Reduce batch sizes for imports
- Use filters to limit data exports
- Close unused browser tabs
- Clear browser cache
-
Network Optimization
- Check network latency to Infrahub
- Use local deployments for development
- Increase timeout settings
-
Infrahub Performance
- Check Infrahub logs for errors
- Monitor database performance
- Verify adequate system resources
Memory issues
Error: "Out of memory" or browser crashes
Solutions:
- Reduce file sizes for imports
- Process data in smaller batches
- Close other applications
- Increase system memory if possible
- Use command-line tools for very large datasets
Browser and interface issues
Display problems
Issues:
- Missing UI elements
- Formatting problems
- Broken layouts
Solutions:
-
Clear Browser Cache
- Hard refresh (Ctrl+F5 or Cmd+Shift+R)
- Clear browser cache and cookies
- Try incognito/private mode
-
Check Browser Compatibility
- Use supported browsers (Chrome, Firefox, Safari, Edge)
- Update to latest browser version
- Disable problematic browser extensions
-
Check Console Errors
- Open browser developer tools (F12)
- Look for JavaScript errors in console
- Check network tab for failed requests
Streamlit-specific issues
Error: "Please run this app with streamlit run"
Solution:
# Ensure you're using the correct command
poetry run streamlit run main.py
# Or for direct Python execution
python -m streamlit run main.py
Error: Session state errors
Solutions:
- Refresh the page
- Clear browser session storage
- Restart Emma application
Configuration issues
Environment variables
Problem: Configuration not being applied
Check List:
-
Verify Variables Are Set
echo $INFRAHUB_ADDRESS
echo $INFRAHUB_API_TOKEN
env | grep INFRAHUB -
Docker Environment Issues
# In docker-compose.yml
environment:
- INFRAHUB_ADDRESS=http://infrahub:8000
- INFRAHUB_API_TOKEN=${INFRAHUB_API_TOKEN} -
Environment File Issues
# Check .env file exists and format
cat .env
# Ensure no spaces around = signs
# CORRECT: INFRAHUB_ADDRESS=http://localhost:8000
# WRONG: INFRAHUB_ADDRESS = http://localhost:8000
Feature flags
Problem: Experimental features not working
Solutions:
# Check feature flags are set
echo $EMMA_FEATURE_FLAGS
# Set feature flags correctly
export EMMA_FEATURE_FLAGS="query_builder,template_builder"
# For Docker
docker run -e EMMA_FEATURE_FLAGS="query_builder" emma
Logging and debugging
Enable debug logging
For Local Development:
# Set Streamlit logging level
export STREAMLIT_LOGGER_LEVEL=debug
# Set Python logging level
export PYTHONPATH=.
poetry run python -c "import logging; logging.basicConfig(level=logging.DEBUG)"
For Docker:
# In docker-compose.yml
environment:
- STREAMLIT_LOGGER_LEVEL=debug
- PYTHONPATH=/app
Check application logs
Local Development:
# Run with verbose output
poetry run streamlit run main.py --logger.level=debug
# Check Emma logs
tail -f ~/.streamlit/logs/
Docker Deployment:
# Check container logs
docker logs emma-emma-1
# Follow logs in real-time
docker logs -f emma-emma-1
Common log patterns
Connection Issues:
ERROR: Failed to connect to Infrahub at http://localhost:8000
ERROR: Authentication failed - invalid token
Schema Issues:
ERROR: Schema validation failed
WARNING: Referenced schema 'Location' not found
Import Issues:
ERROR: Failed to parse CSV at line 123
WARNING: Relationship resolution failed for 'device-01'
Getting help
Before asking for help
- Check this troubleshooting guide
- Review Emma documentation
- Check Infrahub documentation at https://docs.infrahub.app
- Search existing issues on GitHub
Gathering information
When reporting issues, include:
- Emma version and deployment method
- Infrahub version and configuration
- Error messages (full text, not screenshots)
- Steps to reproduce the issue
- Environment details (OS, browser, Docker version)
- Relevant logs with debug logging enabled
Where to get help
- GitHub Issues: https://github.com/opsmill/emma/issues
- Infrahub Community: https://github.com/opsmill/infrahub/discussions
- Documentation: https://docs.infrahub.app
Emergency procedures
If Emma is completely broken:
- Check Infrahub directly to ensure it's working
- Restart Emma application or containers
- Clear browser cache and try again
- Check recent changes and revert if necessary
- Use Infrahub directly as a workaround
If data import corrupted data:
- Stop the import immediately
- Use Infrahub branches to isolate changes
- Review import logs for affected records
- Use Infrahub's version control to revert if needed
- Export and verify data integrity
Remember: Emma is experimental software. Always backup your Infrahub data before major operations and test changes in non-production environments first.