assafelovic/gpt-researcher · error · Exception
Xquik API key not found. Please set the XQUIK_API_KEY enviro
Error message
Xquik API key not found. Please set the XQUIK_API_KEY environment variable. Get a key at https://xquik.com
What it means
The Xquik retriever requires an API key from xquik.com. Its __init__ calls get_api_key(), which reads os.environ['XQUIK_API_KEY']; a KeyError triggers a plain Exception explaining the variable must be set. No network activity happens before this check.
Source
Thrown at gpt_researcher/retrievers/xquik/xquik.py:32
"""
Xquik X/Twitter search retriever.
Searches tweets via the Xquik REST API and returns results in the
standard {title, href, body} format used by all GPT Researcher retrievers.
Set XQUIK_API_KEY in your environment. Get one at https://xquik.com
"""
def __init__(self, query, query_domains=None, **kwargs):
self.query = query
self.query_domains = query_domains
self.api_key = self.get_api_key()
def get_api_key(self):
try:
api_key = os.environ["XQUIK_API_KEY"]
except KeyError:
raise Exception(
"Xquik API key not found. Please set the XQUIK_API_KEY "
"environment variable. Get a key at https://xquik.com"
)
return api_key
def search(self, max_results=10):
"""
Search X/Twitter via Xquik API.
Returns:
list: Search results as [{title, href, body}, ...]
"""
print(f"Searching X/Twitter with query: {self.query}...")
try:
results = self._search_tweets(max_results)
return results
except Exception as e:View on GitHub (pinned to 6f998577d5)
Solutions
- Set the variable: export XQUIK_API_KEY='your-key' or add XQUIK_API_KEY=... to .env and ensure it's loaded at startup.
- Inject it as a secret in Docker/CI (environment: XQUIK_API_KEY=...).
- Obtain a key from https://xquik.com if you don't have one.
- Pre-flight check in code: assert os.environ.get('XQUIK_API_KEY'), before constructing the retriever.
Example fix
# before retriever = XquikRetriever(query='ai') # raises: Xquik API key not found... # after import os os.environ['XQUIK_API_KEY'] = 'your-key' retriever = XquikRetriever(query='ai')
Defensive patterns
Strategy: validation
Validate before calling
import os
if not os.environ.get('XQUIK_API_KEY'):
raise SystemExit('XQUIK_API_KEY is not set — get a key at https://xquik.com') Try / catch
try:
retriever = XquikRetriever(query='...')
except Exception as e:
if 'API key not found' in str(e):
raise SystemExit(f'Config error: {e}')
raise Prevention
- Load .env at startup before constructing retrievers.
- Validate required provider keys in one startup config check.
- Use exact spelling XQUIK_API_KEY; beware autocorrect/typos.
- Manage keys via environment secrets in deploy targets.
When it happens
Trigger: Instantiating the Xquik retriever (or configuring GPT Researcher with the 'xquik' retrieval provider) in a process where XQUIK_API_KEY is unset. The except KeyError converts the failed environment lookup into this message.
Common situations: Env var never exported in the current shell; secrets not wired into the container/CI job; .env file present but not loaded via dotenv; key stored under a misspelled name (XQUIKKEY_API_KEY, XQIK_API_KEY).
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- SerpApi API key not found. Please set the SERPAPI_API_KEY en
- Serper API key not found. Please set the SERPER_API_KEY envi
- FireCrawl API key not found. Please set the FIRECRAWL_API_KE
- Bing API key not found. Please set the BING_API_KEY environm
- Brave Search API key not found. Please set the BRAVE_API_KEY
AI-assisted analysis of assafelovic/gpt-researcher@6f998577d5 (2026-08-28).
Data as JSON: /api/errors/90fcd739835f60da.
Report an issue: GitHub.