datawhalechina/hello-agents · error · AgentException
Miner Agent执行失败: {str(e)}
Error message
Miner Agent执行失败: {str(e)} What it means
Catch-all in MinerAgent.run wrapping any failure of the analysis pipeline: PDF parsing (_parse_paper_content), related-paper retrieval, LLM analysis via think(), or the earlier get_paper lookup (error 57 emerges with this prefix). State flips to 'error' and the original message is preserved in the suffix, which is where diagnosis should focus.
Source
Thrown at Co-creation-projects/Apricity-InnocoreAI/agents/miner.py:100
"paper_id": paper_id,
"report_id": report_id,
"analysis_type": analysis_type,
"parsed_content": {
"sections": list(parsed_content.get("sections", {}).keys()),
"word_count": parsed_content.get("word_count", 0)
},
"related_papers_count": len(related_papers),
"report_summary": {
"summary": report.get("summary", "")[:200] + "...",
"innovation_points": len(report.get("innovation_points", [])),
"limitations": len(report.get("limitations", [])),
"future_ideas": len(report.get("future_ideas", []))
}
}
except Exception as e:
self.set_state("error")
raise AgentException(f"Miner Agent执行失败: {str(e)}")
def get_required_fields(self) -> List[str]:
"""获取必需的输入字段"""
return ["paper_id"]
async def _parse_paper_content(self, paper: Dict) -> Dict[str, Any]:
"""解析论文内容"""
file_path = paper.get("file_path")
if not file_path:
# 如果没有PDF文件,使用标题和摘要
return {
"title": paper.get("title", ""),
"abstract": paper.get("abstract", ""),
"sections": {
"abstract": paper.get("abstract", ""),
"introduction": "",
"method": "",
"experiment": "",View on GitHub (pinned to 606a07d341)
Solutions
- Read the suffix to identify the stage (parse / related-papers / LLM) and fix that root cause.
- Verify the paper's file_path exists and the file is a text-extractable PDF before running analysis.
- Guard optional record fields with .get() defaults so missing abstracts don't crash retrieval.
- Re-raise typed AgentException/TimeoutException unchanged to avoid double prefixes.
- Use raise ... from e for traceable logs.
Example fix
# before
except Exception as e:
self.set_state("error")
raise AgentException(f"Miner Agent执行失败: {str(e)}")
# after
except (AgentException, TimeoutException):
self.set_state("error")
raise
except Exception as e:
self.set_state("error")
raise AgentException(f"Miner Agent执行失败: {e}") from e Defensive patterns
Strategy: try-catch
Validate before calling
# Pre-flight the paper's assets before analysis
import os
if paper.get("file_path") and not os.path.isfile(paper["file_path"]):
logger.warning("PDF missing on disk; analysis will use title+abstract only")
if not (paper.get("abstract") or paper.get("file_path")):
raise ValueError("paper has neither abstract nor PDF — nothing to analyze") Try / catch
try:
report = await miner.run({"paper_id": pid})
except AgentException as e:
root = str(e).replace("Miner Agent执行失败: ", "")
if "LLM思考超时" in root:
report = await miner.run({"paper_id": pid, "analysis_type": "quick"}) # cheaper path
else:
raise Prevention
- Check file_path existence and abstract presence before running analysis.
- Prefer 'quick' analysis_type for large PDFs or slow LLM endpoints.
- Diagnose the suffix (parse/LLM/DB) instead of the wrapper prefix.
When it happens
Trigger: run({'paper_id':...}) where the stored file_path points to a missing/corrupt PDF (parse error); think() timing out on long abstracts (error 46); db errors in _find_related_papers; paper record lacking abstract so downstream indexing fails.
Common situations: PDFs deleted from disk but rows kept in DB; encrypted/scanned PDFs yielding no text; LLM quota exhausted mid-workflow; DB schema migrations dropping fields the miner reads.
Related errors
- 工具 '{tool_name}' 执行失败: {str(e)}
- Coach Agent执行失败: {str(e)}
- Hunter Agent执行失败: {str(e)}
- Validator Agent执行失败: {str(e)}
- 工具 '{tool_name}' 不存在
AI-assisted analysis of datawhalechina/hello-agents@606a07d341 (2026-08-14).
Data as JSON: /api/errors/f3c1dab17b7d9157.
Report an issue: GitHub.