datawhalechina/hello-agents · error · AgentException
Hunter Agent执行失败: {str(e)}
Error message
Hunter Agent执行失败: {str(e)} What it means
Catch-all in HunterAgent.run: failures from the arXiv/IEEE search helpers, filtering, or PDF download steps are re-wrapped with the 'Hunter Agent执行失败:' prefix after setting agent state to 'error'. The original message is preserved, so typical suffixes are 'ArXiv API请求失败: 403' (error 55), 'IEEE API请求失败: 401' (error 56), or download filesystem errors.
Source
Thrown at Co-creation-projects/Apricity-InnocoreAI/agents/hunter.py:88
if downloaded_paper:
downloaded_papers.append(downloaded_paper)
except Exception as e:
self._add_to_history(f"下载论文失败 {paper.get('title', 'Unknown')}: {str(e)}")
self.set_state("completed")
return {
"status": "success",
"total_found": len(all_papers),
"unique_papers": len(unique_papers),
"filtered_papers": len(filtered_papers),
"downloaded_papers": len(downloaded_papers),
"papers": downloaded_papers
}
except Exception as e:
self.set_state("error")
raise AgentException(f"Hunter Agent执行失败: {str(e)}")
def get_required_fields(self) -> List[str]:
"""获取必需的输入字段"""
return ["keywords"]
async def _search_papers_from_arxiv(self, keywords: List[str], max_papers: int, days_back: int) -> List[Dict]:
"""从ArXiv搜索论文"""
papers = []
# 构建查询字符串
query_parts = []
for keyword in keywords:
query_parts.append(f'all:"{keyword}"')
query = " OR ".join(query_parts)
# 添加时间过滤
date_filter = ""
if days_back > 0:View on GitHub (pinned to 606a07d341)
Solutions
- Read the suffix — it names the failing source and HTTP status; fix that (key, quota, path) rather than the wrapper.
- Set the IEEE key in config or exclude 'ieee' from search sources; arXiv alone needs no key.
- Pre-create the PDF download directory and verify write permissions.
- Space out arXiv calls (their guideline is ~1 request/3s) or cache responses.
- Re-raise typed exceptions unchanged (except ExternalAPIException: raise) for cleaner upstream handling.
Example fix
# before
except Exception as e:
self.set_state("error")
raise AgentException(f"Hunter Agent执行失败: {str(e)}")
# after
except ExternalAPIException:
self.set_state("error")
raise
except Exception as e:
self.set_state("error")
raise AgentException(f"Hunter Agent执行失败: {e}") from e Defensive patterns
Strategy: try-catch
Validate before calling
# Pre-flight the hunter's external dependencies
required_paths = [hunter.download_dir]
for p in required_paths:
Path(p).mkdir(parents=True, exist_ok=True)
if "ieee" in sources and not config.ieee_api_key:
sources.remove("ieee") # skip a source that is guaranteed to 401 Try / catch
try:
result = await hunter.run({"keywords": kws})
except AgentException as e:
root = str(e).replace("Hunter Agent执行失败: ", "")
if "ArXiv" in root or "IEEE" in root:
result = await hunter.run({"keywords": kws}, sources=["arxiv"]) # degrade to keyless source
else:
raise Prevention
- Skip configured-but-keyless sources before running.
- Ensure download directories exist and are writable at startup.
- Space out arXiv calls or cache responses to stay under throttling limits.
When it happens
Trigger: run({'keywords':[...]}) where arXiv returns non-200 (rate limit / block), the IEEE key is missing so config.ieee_api_key is '' and the API rejects, or the download directory is unwritable when saving PDFs.
Common situations: Missing IEEE_API_KEY in .env but IEEE included in sources; arXiv throttling burst searches from one IP; PDF save path not created at startup; proxy required but unset in the container.
Related errors
- 工具 '{tool_name}' 执行超时
- 工具 '{tool_name}' 执行失败: {str(e)}
- Coach Agent执行失败: {str(e)}
- ArXiv API请求失败: {response.status}
- Miner Agent执行失败: {str(e)}
AI-assisted analysis of datawhalechina/hello-agents@606a07d341 (2026-08-14).
Data as JSON: /api/errors/ccd9244cd7e6300f.
Report an issue: GitHub.