datawhalechina/hello-agents · error · ValueError
Unsupported reviewer mode: {review_mode}
Error message
Unsupported reviewer mode: {review_mode} What it means
build_reviewer_prompt accepts only the reviewer modes "standard" and "publication"; any other string (after strip+lowercase) raises ValueError. The mode selects the reviewer persona and checklist used to critique analysis reports, so an unknown mode has no prompt template to return.
Source
Thrown at Co-creation-projects/healer-666-Academic-Data-Agent/src/data_analysis_agent/prompts.py:193
- 数据概览
- 方法说明
- 统计学治理说明
- 核心假设检验结论
- 结果解释
- 讨论
- 清洗后数据路径
- 图表引用 such as 
- If any hypothesis test was run, the report must include the test statistic, p-value, effect size, and 95% CI together.
- If more than two groups were compared pairwise, the report must state the multiple-comparison correction method explicitly.
"""
def build_reviewer_prompt(review_mode: str, *, focus_major_issues: bool = False) -> str:
"""Return the system prompt for the reviewer agent."""
normalized_mode = review_mode.strip().lower()
if normalized_mode not in {"standard", "publication"}:
raise ValueError(f"Unsupported reviewer mode: {review_mode}")
if normalized_mode == "publication":
reviewer_role = "You are an exceptionally strict reviewer from a top-tier journal ecosystem such as Nature, Science, or Cell."
checklist = """Review checklist:
- Verify that figure references are present, coherent, and point to this run's actual figure paths.
- If Generated artifacts evidence confirms that figures were saved in this run and artifact validation is green, do not reject solely because the compressed execution trace omits plotting details.
- Verify that any hypothesis test is reported with the test statistic, p-value, effect size, and 95% CI together.
- Verify that multi-group pairwise comparisons explicitly mention Bonferroni correction or Tukey HSD when required.
- Verify that the report does not confuse correlation with causation.
- Verify that there are no obvious logical leaps, implausible claims, over-interpretation relative to the sample size, or conclusions that contradict the execution trace.
- Verify that the report does not cite files, figures, or cleaned-data paths outside the current run directory contract.
- Verify that the chosen methods match the data structure, including dependency, repeated measures, or time-series risks when present.
"""
decision_policy = """Decision policy:
- Return "Accept" only if the report is publication-grade, internally coherent, statistically defensible, and adequately grounded in the supplied evidence.
- Return "Reject" if any major statistical, logical, citation, artifact, or interpretation issue remains.
- You must not invent new results, new p-values, or new evidence that does not appear in the candidate report or the supplied review context.
"""View on GitHub (pinned to 606a07d341)
Solutions
- Use one of the two supported literals: "standard" or "publication" (case/whitespace insensitive).
- Validate/whitelist the mode at the API or config boundary before it reaches the prompt builder.
- Check for typos in the config key carrying the mode (e.g. review_mode vs reviewer_mode).
- If you need a new mode, add it to the {"standard", "publication"} set in prompts.py and supply its checklist.
Example fix
# before
prompt = build_reviewer_prompt(review_mode=requested_mode) # may raise
# after
ALLOWED_MODES = {"standard", "publication"}
mode = requested_mode.strip().lower()
if mode not in ALLOWED_MODES:
raise ValueError(f"review_mode must be one of {sorted(ALLOWED_MODES)}, got '{requested_mode}'")
prompt = build_reviewer_prompt(review_mode=mode) Defensive patterns
Strategy: validation
Validate before calling
ALLOWED_REVIEW_MODES = {"standard", "publication"}
mode = raw_mode.strip().lower()
if mode not in ALLOWED_REVIEW_MODES:
raise ValueError(f"review_mode must be one of {sorted(ALLOWED_REVIEW_MODES)}, got {raw_mode!r}")
prompt = build_reviewer_prompt(review_mode=mode) Type guard
def is_valid_review_mode(mode: str) -> bool:
return isinstance(mode, str) and mode.strip().lower() in {"standard", "publication"} Try / catch
try:
prompt = build_reviewer_prompt(review_mode=mode)
except ValueError:
prompt = build_reviewer_prompt(review_mode="standard") # explicit fallback, logged Prevention
- Constrain reviewer mode inputs with an enum/dropdown in the UI instead of free text.
- Whitelist modes at the API boundary, not deep in the prompt builder.
- Document the two supported modes in the request schema (Literal type).
When it happens
Trigger: Calling build_reviewer_prompt(review_mode="strict"), "fast", "Publication " (works, normalized) vs. typo'd values like "pubilcation", or passing a user-supplied config value that was never validated upstream.
Common situations: Typos in configuration files or CLI flags; new reviewer modes expected by callers after a version change; user-facing UI letting free-text mode input through to the prompt builder.
Related errors
- Unsupported latency_mode: {latency_mode}
- Unsupported vision_review_mode: {vision_review_mode}
- Unsupported quality_mode: {quality_mode}
- Unsupported document_ingestion_mode: {mode}
- {name} 必须是数字
AI-assisted analysis of datawhalechina/hello-agents@606a07d341 (2026-08-14).
Data as JSON: /api/errors/8cbcc02a4c5eb1b5.
Report an issue: GitHub.