{"record":{"id":"f5161a360f1b6eee","repo":"assafelovic/gpt-researcher","slug":"no-results-found-with-fastcrw-api-search","errorCode":null,"errorMessage":"No results found with fastCRW API search.","messagePattern":"No results found with fastCRW API search\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"gpt_researcher/retrievers/crw/crw.py","lineNumber":112,"sourceCode":"        response.raise_for_status()\n        results = response.json()\n        # fastCRW wraps responses in a {success, error, data} envelope.\n        if results.get(\"success\") is False:\n            raise Exception(results.get(\"error\", \"fastCRW API search failed.\"))\n        return results\n\n    def search(self, max_results=10):\n        \"\"\"\n        Searches the query\n        Returns:\n\n        \"\"\"\n        try:\n            # Search the query\n            results = self._search(self.query, max_results=max_results)\n            sources = results.get(\"data\") or []\n            if not isinstance(sources, list) or not sources:\n                raise Exception(\"No results found with fastCRW API search.\")\n            # Return the results. A source missing \"url\" is unusable, so skip it\n            # rather than raising a KeyError that discards the whole result set.\n            search_response = []\n            for obj in sources:\n                if not isinstance(obj, dict):\n                    continue\n                href = obj.get(\"url\") or \"\"\n                if not href:\n                    continue\n                search_response.append(\n                    {\n                        \"href\": href,\n                        \"body\": obj.get(\"markdown\") or obj.get(\"description\") or \"\",\n                    }\n                )\n        except Exception as e:\n            print(f\"Error: {e}. Failed fetching sources. Resulting in empty response.\")\n            search_response = []","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/assafelovic/gpt-researcher/blob/6f998577d547b1e54ec662dac63583aa11e3b84b/gpt_researcher/retrievers/crw/crw.py#L94-L130","documentation":"Exception raised by the fastCRW retriever's public search() when the response envelope's data field is missing, empty, or not a list — i.e. the API call succeeded but returned zero usable sources for the query.","triggerScenarios":"search() calls _search(); results.get(\"data\") is None, empty, or a non-list (e.g. an error dict), triggering the raise.","commonSituations":"Overly narrow/obscure queries with no matches, upstream data source returning empty sets, or API responses where data is renamed/restructured after an update.","solutions":["Broaden or rephrase the query and retry.","Inspect the raw fastCRW response for that query (curl it) to confirm data is genuinely empty.","Handle the exception and fall back to another retriever for empty-result cases.","If data exists but has a new shape, update the parsing in search()."],"exampleFix":"# before\nresults = retriever.search()\n\n# after\ntry:\n    results = retriever.search()\nexcept Exception as e:\n    if \"No results\" in str(e):\n        results = []\n    else:\n        raise","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try:\n    results = retriever.search()\nexcept Exception as e:\n    results = [] if \"No results\" in str(e) else raise_","preventionTips":["Treat empty results as a soft condition, not a crash; broaden queries.","Inspect raw responses when queries unexpectedly return nothing.","Distinguish envelope errors (27) from empty-data errors (28) in handling."],"tags":["fastcrw","empty-results","search"],"backgroundTag":"empty-search-results","analyzedSha":"6f998577d547b1e54ec662dac63583aa11e3b84b","analyzedAt":"2026-08-28T17:50:07.383Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}