{"record":{"id":"90fcd739835f60da","repo":"assafelovic/gpt-researcher","slug":"xquik-api-key-not-found-please-set-the-xquik-api","errorCode":null,"errorMessage":"Xquik API key not found. Please set the XQUIK_API_KEY environment variable. Get a key at https://xquik.com","messagePattern":"Xquik API key not found\\. Please set the XQUIK_API_KEY environment variable\\. Get a key at https://xquik\\.com","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"gpt_researcher/retrievers/xquik/xquik.py","lineNumber":32,"sourceCode":"    \"\"\"\n    Xquik X/Twitter search retriever.\n\n    Searches tweets via the Xquik REST API and returns results in the\n    standard {title, href, body} format used by all GPT Researcher retrievers.\n\n    Set XQUIK_API_KEY in your environment. Get one at https://xquik.com\n    \"\"\"\n\n    def __init__(self, query, query_domains=None, **kwargs):\n        self.query = query\n        self.query_domains = query_domains\n        self.api_key = self.get_api_key()\n\n    def get_api_key(self):\n        try:\n            api_key = os.environ[\"XQUIK_API_KEY\"]\n        except KeyError:\n            raise Exception(\n                \"Xquik API key not found. Please set the XQUIK_API_KEY \"\n                \"environment variable. Get a key at https://xquik.com\"\n            )\n        return api_key\n\n    def search(self, max_results=10):\n        \"\"\"\n        Search X/Twitter via Xquik API.\n\n        Returns:\n            list: Search results as [{title, href, body}, ...]\n        \"\"\"\n        print(f\"Searching X/Twitter with query: {self.query}...\")\n\n        try:\n            results = self._search_tweets(max_results)\n            return results\n        except Exception as e:","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/assafelovic/gpt-researcher/blob/6f998577d547b1e54ec662dac63583aa11e3b84b/gpt_researcher/retrievers/xquik/xquik.py#L14-L50","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"# before\nretriever = XquikRetriever(query='ai')  # raises: Xquik API key not found...\n\n# after\nimport os\nos.environ['XQUIK_API_KEY'] = 'your-key'\nretriever = XquikRetriever(query='ai')","handlingStrategy":"validation","validationCode":"import os\n\nif not os.environ.get('XQUIK_API_KEY'):\n    raise SystemExit('XQUIK_API_KEY is not set — get a key at https://xquik.com')","typeGuard":null,"tryCatchPattern":"try:\n    retriever = XquikRetriever(query='...')\nexcept Exception as e:\n    if 'API key not found' in str(e):\n        raise SystemExit(f'Config error: {e}')\n    raise","preventionTips":["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."],"tags":["xquik","api-key","environment-variable","configuration","retriever"],"backgroundTag":"missing-env-var","analyzedSha":"6f998577d547b1e54ec662dac63583aa11e3b84b","analyzedAt":"2026-08-28T17:50:07.383Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}