assafelovic/gpt-researcher · warning · UserWarning

Invalid report type: {report_type}. Please use one of the fo

Error message

Invalid report type: {report_type}.
Please use one of the following: {', '.join([enum_value for enum_value in report_type_mapping.keys()])}
Using default report type: {default_report_type} prompt.

What it means

UserWarning from get_prompt_by_report_type: the report_type string you passed is not a key in report_type_mapping, so gpt-researcher falls back to the default 'research_report' prompt instead of failing. Output will still be produced, just with the default prompt template.

Source

Thrown at gpt_researcher/prompts.py:869

report_type_mapping = {
    ReportType.ResearchReport.value: "generate_report_prompt",
    ReportType.ResourceReport.value: "generate_resource_report_prompt",
    ReportType.OutlineReport.value: "generate_outline_report_prompt",
    ReportType.CustomReport.value: "generate_custom_report_prompt",
    ReportType.SubtopicReport.value: "generate_subtopic_report_prompt",
    ReportType.DeepResearch.value: "generate_deep_research_prompt",
}


def get_prompt_by_report_type(
    report_type: str,
    prompt_family: type[PromptFamily] | PromptFamily,
):
    prompt_by_type = getattr(prompt_family, report_type_mapping.get(report_type, ""), None)
    default_report_type = ReportType.ResearchReport.value
    if not prompt_by_type:
        warnings.warn(
            f"Invalid report type: {report_type}.\n"
            f"Please use one of the following: {', '.join([enum_value for enum_value in report_type_mapping.keys()])}\n"
            f"Using default report type: {default_report_type} prompt.",
            UserWarning,
        )
        prompt_by_type = getattr(prompt_family, report_type_mapping.get(default_report_type))
    return prompt_by_type


prompt_family_mapping = {
    PromptFamilyEnum.Default.value: PromptFamily,
    PromptFamilyEnum.Granite.value: GranitePromptFamily,
    PromptFamilyEnum.Granite3.value: Granite3PromptFamily,
    PromptFamilyEnum.Granite31.value: Granite3PromptFamily,
    PromptFamilyEnum.Granite32.value: Granite3PromptFamily,
    PromptFamilyEnum.Granite33.value: Granite33PromptFamily,
}

View on GitHub (pinned to 6f998577d5)

Solutions

  1. Use a valid ReportType value, e.g. 'research_report', 'summary_report', 'detailed_report' (check gpt_researcher's ReportType enum / report_type_mapping keys).
  2. If report_type comes from user input, validate it against the enum before constructing the researcher.
  3. Upgrade/verify against your installed version — the accepted list can change between releases.

Example fix

# before
researcher = GPTResearcher(query=q, report_type="summery_report")
# after
from gpt_researcher.utils.enum import ReportType
researcher = GPTResearcher(query=q, report_type=ReportType.SummaryReport.value)
Defensive patterns

Strategy: type-guard

Validate before calling

from gpt_researcher.prompts import report_type_mapping
if report_type not in report_type_mapping:
    report_type = "research_report"  # or raise your own error

Type guard

from gpt_researcher.prompts import report_type_mapping

def is_valid_report_type(rt: str) -> bool:
    return rt in report_type_mapping

Prevention

When it happens

Trigger: Calling GPTResearcher with report_type='custom_thing' or a typo like 'sumary_report'/'research-report' (hyphen instead of underscore); generate_report() calls this internally.

Common situations: Typos in report_type, using a value from an outdated version after a rename, or dynamically built report types from user input.

Related errors


AI-assisted analysis of assafelovic/gpt-researcher@6f998577d5 (2026-08-28). Data as JSON: /api/errors/dd94849a41f84253. Report an issue: GitHub.