{"record":{"id":"464196e6d19b521c","repo":"datawhalechina/hello-agents","slug":"20","errorCode":null,"errorMessage":"会议记录过短，请至少提供 20 个字符","messagePattern":"会议记录过短，请至少提供 20 个字符","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Co-creation-projects/Henry2513-MeetingActionAgent/main.ipynb","lineNumber":362,"sourceCode":"   \"metadata\": {},\n   \"source\": [\n    \"## 6. 完整分析流程\\n\",\n    \"\\n\",\n    \"首次审核通过时只调用两次模型；未通过且仍有两次预算时，MinutesAgent 修正一次，再由 ReviewAgent 最终复核。\\n\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"id\": \"225d6a8f\",\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"# 检查并清理输入的会议文本。\\n\",\n    \"def validate_transcript(transcript: str) -> str:\\n\",\n    \"    cleaned = transcript.strip()\\n\",\n    \"    if len(cleaned) < 20:\\n\",\n    \"        raise ValueError(\\\"会议记录过短，请至少提供 20 个字符\\\")\\n\",\n    \"    return cleaned\\n\",\n    \"\\n\",\n    \"\\n\",\n    \"# 组合审核会议纪要所需的提示词。\\n\",\n    \"def make_review_prompt(transcript: str, draft: MeetingResult) -> str:\\n\",\n    \"    return (\\n\",\n    \"        \\\"请审核以下会议纪要草稿。\\\\n\\\\n\\\"\\n\",\n    \"        f\\\"【会议原文】\\\\n{transcript}\\\\n\\\\n\\\"\\n\",\n    \"        f\\\"【纪要草稿】\\\\n{draft.model_dump_json(indent=2)}\\\"\\n\",\n    \"    )\\n\",\n    \"\\n\",\n    \"\\n\",\n    \"# 执行纪要提取、审核和必要时修正的完整流程。\\n\",\n    \"def analyze_meeting(transcript: str) -> tuple[MeetingResult, ReviewResult, int]:\\n\",\n    \"    transcript = validate_transcript(transcript)\\n\",\n    \"    minutes_agent, review_agent = build_agents()\\n\",\n    \"    budget = CallBudget(maximum=4)\\n\",\n    \"\\n\",","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/datawhalechina/hello-agents/blob/606a07d341a47be773fab7f4b71177f53f96b2c3/Co-creation-projects/Henry2513-MeetingActionAgent/main.ipynb#L344-L380","documentation":"This ValueError is raised by the notebook's own validate_transcript() helper when the meeting transcript passed to the agent pipeline is empty or shorter than 20 characters after stripping whitespace. It is a domain-level input guard, not a library error: the agent refuses to summarize content that is too short to be a real meeting record. The 20-character floor is hardcoded in the cell at main.ipynb:362.","triggerScenarios":"Calling validate_transcript(transcript) with an empty string, a whitespace-only string, or a transcript whose stripped length is < 20 (e.g. passing an unpopulated variable, a placeholder like \"会议内容\", or a UI textarea submitted before the user pasted the meeting notes). The function is invoked before make_review_prompt()/the summarization flow, so any short input reaching the pipeline triggers it.","commonSituations":"Demo notebooks run top-to-bottom without filling in the sample transcript; a variable named transcript left as '' from an earlier cell; copy-pasting only a title or greeting instead of the full minutes; automated tests feeding fixture strings shorter than 20 chars; trailing-newline-only input from a file read.","solutions":["Provide a real meeting transcript of at least 20 non-whitespace characters before running the pipeline (e.g. assign transcript = '<pasted meeting notes>' in the preceding cell).","If this fires during automated testing, make the test fixture >= 20 characters or monkeypatch/relax the threshold via a parameter.","If short inputs are legitimate in your flow, refactor validate_transcript(transcript: str, min_len: int = 20) and pass a smaller min_len explicitly instead of editing the constant.","Add an upstream length check at the UI/API boundary so users get a friendly message before the agent cell runs."],"exampleFix":"// before\ndef validate_transcript(transcript: str) -> str:\n    cleaned = transcript.strip()\n    if len(cleaned) < 20:\n        raise ValueError(\"会议记录过短，请至少提供 20 个字符\")\n    return cleaned\n\n// after\ndef validate_transcript(transcript: str, min_len: int = 20) -> str:\n    cleaned = transcript.strip()\n    if len(cleaned) < min_len:\n        raise ValueError(f\"会议记录过短，请至少提供 {min_len} 个字符\")\n    return cleaned","handlingStrategy":"validation","validationCode":"MIN_LEN = 20\n\ndef is_valid_transcript(transcript: str) -> bool:\n    return isinstance(transcript, str) and len(transcript.strip()) >= MIN_LEN\n\n# before calling the pipeline:\nif not is_valid_transcript(transcript):\n    raise ValueError(f\"transcript too short: need >= {MIN_LEN} chars, got {len(transcript.strip())}\")","typeGuard":"def is_meeting_transcript(value: object) -> TypeGuard[str]:\n    return isinstance(value, str) and len(value.strip()) >= 20","tryCatchPattern":"try:\n    cleaned = validate_transcript(transcript)\nexcept ValueError as e:\n    # input error: surface to the user, do not retry\n    print(f\"输入有误: {e}\")\n    raise SystemExit(1) from e","preventionTips":["Check len(transcript.strip()) >= 20 at the UI/API boundary before the notebook cell runs.","Never leave transcript as an empty placeholder; assign sample minutes in the preceding cell.","Keep test fixtures at least 20 characters so unit tests exercise the happy path.","Make the minimum length a named parameter instead of a hardcoded constant so callers can tune it."],"tags":["input-validation","notebook","meeting-agent","python"],"backgroundTag":null,"analyzedSha":"606a07d341a47be773fab7f4b71177f53f96b2c3","analyzedAt":"2026-08-14T22:57:27.446Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}