assafelovic/gpt-researcher · warning · UserWarning
Invalid prompt family: {prompt_family_name}. Please use one
Error message
Invalid prompt family: {prompt_family_name}.
Please use one of the following: {', '.join([enum_value for enum_value in prompt_family_mapping.keys()])}
Using default prompt family: {PromptFamilyEnum.Default.value} prompt. What it means
UserWarning from get_prompt_family: prompt_family_name is not a key in prompt_family_mapping, so the default PromptFamily is used instead of raising. Your custom prompt family's instructions are silently ignored and stock prompts are applied.
Source
Thrown at gpt_researcher/prompts.py:897
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,
}
def get_prompt_family(
prompt_family_name: PromptFamilyEnum | str, config: Config,
) -> PromptFamily:
"""Get a prompt family by name or value."""
if isinstance(prompt_family_name, PromptFamilyEnum):
prompt_family_name = prompt_family_name.value
if prompt_family := prompt_family_mapping.get(prompt_family_name):
return prompt_family(config)
warnings.warn(
f"Invalid prompt family: {prompt_family_name}.\n"
f"Please use one of the following: {', '.join([enum_value for enum_value in prompt_family_mapping.keys()])}\n"
f"Using default prompt family: {PromptFamilyEnum.Default.value} prompt.",
UserWarning,
)
return PromptFamily()
View on GitHub (pinned to 6f998577d5)
Solutions
- Pass a valid PromptFamilyEnum value (e.g. 'default', or whichever families are registered in gpt_researcher/prompts.py prompt_family_mapping).
- For custom families, register your PromptFamily subclass in prompt_family_mapping or pass the family per its documented registration mechanism for your version.
- Print list(prompt_family_mapping.keys()) for your installed version to see accepted names.
Example fix
# before researcher = GPTResearcher(query=q, prompt_family="my-custom") # not registered # after from gpt_researcher.prompts import prompt_family_mapping, PromptFamilyEnum print(list(prompt_family_mapping)) # pick a valid name researcher = GPTResearcher(query=q, prompt_family=PromptFamilyEnum.Default.value)
Defensive patterns
Strategy: type-guard
Validate before calling
from gpt_researcher.prompts import prompt_family_mapping
if name not in prompt_family_mapping:
name = "default" Type guard
from gpt_researcher.prompts import prompt_family_mapping
def is_valid_prompt_family(name: str) -> bool:
return name in prompt_family_mapping Prevention
- Print prompt_family_mapping keys for your installed version before choosing a name.
- Register custom prompt families in the mapping rather than passing unregistered strings.
When it happens
Trigger: Passing prompt_family="my_family" to GPTResearcher when it isn't registered in prompt_family_mapping, or a typo/case mismatch of a known name; called from GPTResearcher.__init__.
Common situations: Custom prompt families not registered in the mapping after upgrade, renamed built-in families, or string typos; code that passes a class instead of a registered name/value.
Related errors
- EMBEDDING_PROVIDER is deprecated and will be removed soon. U
- LLM_PROVIDER, FAST_LLM_MODEL and SMART_LLM_MODEL are depreca
- Invalid report type: {report_type}. Please use one of the fo
- Cost must be an integer or float
- Embedding provider not found.
AI-assisted analysis of assafelovic/gpt-researcher@6f998577d5 (2026-08-28).
Data as JSON: /api/errors/19293306d56d665c.
Report an issue: GitHub.