OpenBMB/ChatDev · error · ConfigError
retrieve_stage entries must be one of {[stage.value for stag
Error message
retrieve_stage entries must be one of {[stage.value for stage in AgentExecFlowStage]} What it means
MemoryRetrieveConfig.from_dict validates each entry of the 'retrieve_stage' list against the AgentExecFlowStage enum. An entry whose value does not match any stage value raises this ConfigError with the failing index in the path.
Source
Thrown at entity/configs/node/memory.py:448
similarity_threshold: float = -1.0
read: bool = True
write: bool = True
@classmethod
def from_dict(cls, data: Mapping[str, Any], *, path: str) -> "MemoryAttachmentConfig":
mapping = require_mapping(data, path)
name = require_str(mapping, "name", path)
stages_raw = mapping.get("retrieve_stage")
stages: List[AgentExecFlowStage] | None = None
if stages_raw is not None:
stage_list = ensure_list(stages_raw)
parsed: List[AgentExecFlowStage] = []
for idx, item in enumerate(stage_list):
try:
parsed.append(AgentExecFlowStage(item))
except ValueError as exc:
raise ConfigError(
f"retrieve_stage entries must be one of {[stage.value for stage in AgentExecFlowStage]}",
extend_path(path, f"retrieve_stage[{idx}]"),
) from exc
stages = parsed
top_k_value = mapping.get("top_k", 3)
if not isinstance(top_k_value, int) or top_k_value <= 0:
raise ConfigError("top_k must be a positive integer", extend_path(path, "top_k"))
threshold_value = mapping.get("similarity_threshold", -1.0)
if not isinstance(threshold_value, (int, float)):
raise ConfigError("similarity_threshold must be numeric", extend_path(path, "similarity_threshold"))
read_value = mapping.get("read", True)
if not isinstance(read_value, bool):
raise ConfigError("read must be boolean", extend_path(path, "read"))
write_value = mapping.get("write", True)View on GitHub (pinned to 4fb2db0ea9)
Solutions
- Fix the entry to one of the enum's string values listed in the error message
- Check the AgentExecFlowStage enum definition for the exact accepted values in your version
- Quote stage names in YAML to avoid type coercion surprises
Example fix
# before retrieve_stage: - befor_llm # after retrieve_stage: - before_llm
Defensive patterns
Strategy: validation
Validate before calling
from entity... import AgentExecFlowStage
valid = {s.value for s in AgentExecFlowStage}
assert all(str(x) in valid for x in cfg.get('retrieve_stage', [])) Type guard
def is_valid_stage(v) -> bool:
return v in {s.value for s in AgentExecFlowStage} Try / catch
try:
cfg = MemoryRetrieveConfig.from_dict(data, path='retrieve')
except ConfigError as e:
if 'retrieve_stage' in str(e):
cfg = MemoryRetrieveConfig.from_dict({**data, 'retrieve_stage': ['before_llm']}, path='retrieve') Prevention
- Pull allowed stage names from the enum, don't hardcode
- Add config linting for enum fields
When it happens
Trigger: Passing retrieve_stage: ['befor_llm'] (typo) or a stage name not in AgentExecFlowStage's values when parsing a memory retrieve config.
Common situations: Typos in stage names in YAML; using stage names from a different version where enum values were renamed; passing arbitrary strings like 'all' or 'pre'.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- model.input_mode must be 'prompt' or 'messages'
- memories must be a list
- role must be 'user' or 'assistant'
- duration_unit must be one of: {', '.join(valid_units)}
- file_types entries must be strings
AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27).
Data as JSON: /api/errors/544f592106a696e3.
Report an issue: GitHub.