Common Issues
This page covers the most common issues you might encounter when using the Clio SDK and how to resolve them.
Installation Issues
Section titled “Installation Issues”ImportError: No module named ‘clio’
Section titled “ImportError: No module named ‘clio’”Problem: Python can’t find the Clio SDK module.
Solutions:
-
Check if installed:
Terminal window pip list | grep clio -
Install the SDK:
Terminal window pip install clio -
Virtual environment issues:
Terminal window # Make sure you're in the right environmentwhich pythonwhich pip# Activate your virtual environmentsource venv/bin/activate # Linux/macOS# orvenv\Scripts\activate # Windows -
Development installation:
Terminal window # If installing from sourcecd clio-sdk/sdkpip install -e .
Playwright Installation Issues
Section titled “Playwright Installation Issues”Problem: Playwright browsers not installed or not working.
Solutions:
-
Install Playwright and browsers:
Terminal window pip install playwrightplaywright install -
Install specific browsers:
Terminal window playwright install chromium # Just Chromiumplaywright install --with-deps # Include system dependencies -
Permission issues (Linux):
Terminal window sudo playwright install-deps
Authentication Issues
Section titled “Authentication Issues””Invalid API key format” Error
Section titled “”Invalid API key format” Error”Problem: API key doesn’t start with clio_ or is malformed.
Solutions:
-
Check API key format:
api_key = os.getenv("CLIO_API_KEY")print(f"API key starts with 'clio_': {api_key.startswith('clio_') if api_key else False}") -
Get a new API key:
- Log into your Clio dashboard
- Go to Settings → API Keys
- Generate a new key
- Copy the entire key including
clio_prefix
-
Check for whitespace:
# Trim whitespaceapi_key = os.getenv("CLIO_API_KEY", "").strip()
ClioAuthError: “Invalid API key”
Section titled “ClioAuthError: “Invalid API key””Problem: API key format is correct but authentication fails.
Solutions:
-
Verify key is active:
- Check your Clio dashboard
- Ensure the API key hasn’t been revoked
- Try generating a new key
-
Check server URL:
# Make sure you're connecting to the right servermonitor = ClioMonitor(api_key="clio_your_key",base_url="https://api.cliomonitoring.com" # Correct URL) -
Network connectivity:
Terminal window # Test connectivitycurl -I https://api.cliomonitoring.com
Environment Variable Not Set
Section titled “Environment Variable Not Set”Problem: CLIO_API_KEY environment variable is not found.
Solutions:
-
Set environment variable:
Terminal window export CLIO_API_KEY="clio_your_key_here" -
Use .env file:
Terminal window # Create .env fileecho "CLIO_API_KEY=clio_your_key_here" > .env# Load in Pythonfrom dotenv import load_dotenvload_dotenv() -
Check current environment:
import osprint("Environment variables:")for key, value in os.environ.items():if "CLIO" in key:print(f"{key}=***masked***")
Video Recording Issues
Section titled “Video Recording Issues”No Video Files Created
Section titled “No Video Files Created”Problem: Playwright isn’t creating video files.
Solutions:
-
Enable video recording:
context = await browser.new_context(record_video_dir="./videos", # Must be setrecord_video_size={"width": 1280, "height": 720}) -
Check directory exists:
import osos.makedirs("./videos", exist_ok=True) -
Verify permissions:
Terminal window ls -la videos/chmod 755 videos/ # Ensure writable -
Check for video files:
from pathlib import Pathvideo_files = list(Path("./videos").glob("*.webm"))print(f"Found videos: {video_files}")
Video Files Not Uploaded
Section titled “Video Files Not Uploaded”Problem: Video files are created but not uploaded to Clio.
Solutions:
-
Check monitoring was started:
await monitor.start_run(context, "Test Name") # Must call this -
Ensure context.close() is called:
try:# Your automation codepassfinally:await context.close() # Upload happens here -
Check for upload errors:
monitor = ClioMonitor(api_key="clio_key",raise_on_error=True # See upload errors) -
Verify network connectivity:
# Test with shorter timeout to see errors fastermonitor = ClioMonitor(api_key="clio_key", timeout=10)
Upload Issues
Section titled “Upload Issues”ClioUploadError: “Upload timed out”
Section titled “ClioUploadError: “Upload timed out””Problem: Large files timing out during upload.
Solutions:
-
Increase timeout:
monitor = ClioMonitor(api_key="clio_key",timeout=300 # 5 minutes) -
Check file sizes:
from pathlib import Pathfor video in Path("./videos").glob("*.webm"):size_mb = video.stat().st_size / (1024 * 1024)print(f"{video.name}: {size_mb:.1f} MB") -
Reduce video quality (if files are very large):
context = await browser.new_context(record_video_dir="./videos",record_video_size={"width": 1280, "height": 720} # Smaller size)
Upload Retries Exhausted
Section titled “Upload Retries Exhausted”Problem: All retry attempts fail.
Solutions:
-
Increase retry attempts:
monitor = ClioMonitor(api_key="clio_key",retry_attempts=5 # More retries) -
Check network stability:
Terminal window ping api.cliomonitoring.com -
Use exponential backoff manually:
import asynciofor attempt in range(3):try:await monitor.start_run(context, "Test")breakexcept ClioUploadError:if attempt < 2:await asyncio.sleep(2 ** attempt)else:raise
Configuration Issues
Section titled “Configuration Issues”SSL Certificate Errors
Section titled “SSL Certificate Errors”Problem: SSL verification failures.
Solutions:
-
For development only - disable SSL verification:
monitor = ClioMonitor(api_key="clio_key",verify_ssl=False # Only for localhost/development) -
Update certificates:
Terminal window # Update system certificatespip install --upgrade certifi -
Corporate proxy/firewall:
# May need custom configuration for corporate environments# Check with your IT department
Base URL Configuration
Section titled “Base URL Configuration”Problem: Can’t connect to custom Clio server.
Solutions:
-
Check URL format:
# Correct formatsbase_url = "https://api.cliomonitoring.com" # Productionbase_url = "http://localhost:8000" # Local devbase_url = "https://staging.cliomonitoring.com" # Staging# Incorrect formatsbase_url = "api.cliomonitoring.com" # Missing protocolbase_url = "ftp://api.cliomonitoring.com" # Wrong protocol -
Test connectivity:
Terminal window curl -I http://localhost:8000/health
Performance Issues
Section titled “Performance Issues”Slow Upload Times
Section titled “Slow Upload Times”Problem: Uploads taking too long.
Solutions:
-
Check file sizes:
# Large videos take longer to upload# Consider shorter test scenarios -
Network optimization:
# Use concurrent uploads (automatic in SDK)# Ensure good network connection -
Monitor upload progress:
import logginglogging.basicConfig(level=logging.DEBUG)# Will show upload progress for large files
Memory Issues with Large Files
Section titled “Memory Issues with Large Files”Problem: Out of memory errors with large video files.
Solutions:
-
SDK automatically streams large files (>10MB), but you can:
# Reduce video recording time# Split long tests into smaller chunks -
Monitor memory usage:
import psutilprocess = psutil.Process()print(f"Memory usage: {process.memory_info().rss / 1024 / 1024:.1f} MB")
Rate Limiting Issues
Section titled “Rate Limiting Issues”ClioRateLimitError: “Monthly rate limit exceeded”
Section titled “ClioRateLimitError: “Monthly rate limit exceeded””Problem: Exceeded your monthly upload quota.
Solutions:
-
Check your usage:
- Log into Clio dashboard
- View usage statistics
- Consider upgrading your plan
-
Optimize test frequency:
# Run monitoring only on important tests# Skip monitoring for local developmentif os.getenv("ENVIRONMENT") == "production":await monitor.start_run(context, "Test") -
Batch testing:
# Combine multiple test cases into single runs# Reduce number of separate uploads
Debugging Tips
Section titled “Debugging Tips”Enable Debug Logging
Section titled “Enable Debug Logging”import logginglogging.basicConfig( level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# Now you'll see detailed SDK logsTest Configuration
Section titled “Test Configuration”def test_clio_setup(): """Test Clio configuration before running automation""" try: api_key = os.getenv("CLIO_API_KEY") if not api_key: print("❌ CLIO_API_KEY not set") return False
if not api_key.startswith("clio_"): print("❌ Invalid API key format") return False
monitor = ClioMonitor(api_key=api_key) print("✅ ClioMonitor created successfully") return True
except Exception as e: print(f"❌ Configuration error: {e}") return False
# Run before your automationif not test_clio_setup(): exit(1)Check SDK Version
Section titled “Check SDK Version”import clioprint(f"Clio SDK version: {clio.__version__}")
# Update if needed# pip install --upgrade clioGetting Help
Section titled “Getting Help”If you’re still having issues:
- Check the logs - Enable debug logging to see detailed information
- Test with minimal example - Use the basic example to isolate issues
- Check the dashboard - Look for error messages in your Clio dashboard
- Update dependencies - Ensure you’re using the latest SDK version
- Contact support - Reach out with specific error messages and logs
Minimal Reproduction Case
Section titled “Minimal Reproduction Case”When reporting issues, create a minimal example:
import osfrom clio import ClioMonitor
# Minimal test caseapi_key = os.getenv("CLIO_API_KEY", "clio_test_key_for_format_check")
try: monitor = ClioMonitor(api_key=api_key, raise_on_error=True) print("✅ Basic initialization works")except Exception as e: print(f"❌ Error: {e}") # Include this error message when reporting issues