Common errors
This page covers the most common issues you might encounter when using the Tweet Audit Tool and how to resolve them.Environment and configuration errors
GEMINI_API_KEY is required
GEMINI_API_KEY is required
Error message:Cause: The tool cannot find your Gemini API key in the environment.Solution:
Get an API key
If you don’t have an API key yet, get one from Google AI Studio
Make sure there are no spaces around the
= sign and no quotes around the key value.Tweet archive not found
Tweet archive not found
Error message:Cause: The tool cannot find your Twitter archive file in the expected location.Solution:
Request your archive
If you haven’t already, request your archive from X:
- Go to X.com → More → Settings and Privacy → Your Account
- Click “Download an archive of your data”
- Wait 24-48 hours for the email
Corrupted checkpoint file
Corrupted checkpoint file
Error message:Cause: The checkpoint file that tracks progress has become corrupted.Solution:Simply delete the checkpoint file and restart:
File format errors
Missing required column: id
Missing required column: id
Error message:Cause: The transformed CSV file is corrupted or incomplete.Solution:Delete the corrupted CSV and re-extract tweets from the archive:
Invalid JSON in archive
Invalid JSON in archive
Missing required field in archive
Missing required field in archive
Error message:Cause: The archive file format doesn’t match the expected Twitter export structure.Solution:Ensure you’re using the official Twitter/X archive export:
- The file should come from X.com’s “Download an archive of your data” feature
- The JSON should contain a list of objects with a
tweetkey - Each tweet should have
id_strandfull_textfields
If you’re using an old archive format, you may need to request a fresh archive export from X.
Invalid CSV format
Invalid CSV format
Error message:Cause: The CSV file has formatting issues.Solution:Re-extract tweets to regenerate the CSV:
API and analysis errors
Rate limit errors (429)
Rate limit errors (429)
Error message:Cause: You’re hitting Gemini API rate limits.Solution:The tool automatically retries with exponential backoff, but you can also:
Check your quota
Visit Google AI Studio to check your API quota limits
Gemini 2.5 Flash free tier: 15 requests per minute, 1,500 per day. For large tweet volumes, spread analysis over multiple days.
Empty response from Gemini
Empty response from Gemini
Error message:Cause: The API returned no content for a specific tweet.Solution:This is usually a transient error. The tool will:
- Automatically retry up to 3 times with exponential backoff
- If it continues failing, the tweet may contain content that Gemini cannot process
Invalid Gemini response format
Invalid Gemini response format
Error message:Cause: Gemini returned a response in an unexpected format.Solution:This indicates an issue with the AI model’s output format. Try:
Check API status
If the issue persists, check Google Cloud Status for API outages
Connection and timeout errors
Connection and timeout errors
Error messages:Cause: Network issues or temporary API unavailability.Solution:The tool automatically retries with exponential backoff for:
- Timeouts
- Connection errors
- Rate limits (429)
- Service unavailable (503)
- Quota errors
- Check your internet connection
- Wait a few minutes and resume analysis
- The checkpoint system ensures you don’t lose progress
Permission errors
Analysis quality issues
Gemini returns “KEEP” for everything
Symptom: The analysis completes but no tweets are flagged for deletion, even though you expected some to be flagged. Cause: Your criteria might be too lenient or not specific enough. Solution:Test on a sample
Before re-running on all tweets:
- Create a small test archive with 5-10 known problematic tweets
- Run the analysis
- Verify the results match your expectations
- Adjust criteria as needed
Getting help
If you encounter an error not listed here:- Check the logs: Set
LOG_LEVEL=DEBUGin your.envfor detailed logging - Search existing issues: Check the GitHub issues
- Report a bug: Open a new issue with:
- The full error message
- Your Python version (
python --version) - Steps to reproduce
- Relevant log output (with sensitive data removed)
Remember to never share your actual API keys or personal tweet content when reporting issues.