{"record":{"id":"544f592106a696e3","repo":"OpenBMB/ChatDev","slug":"retrieve-stage-entries-must-be-one-of-stage-valu","errorCode":null,"errorMessage":"retrieve_stage entries must be one of {[stage.value for stage in AgentExecFlowStage]}","messagePattern":"retrieve_stage entries must be one of (.+?)","errorType":"validation","errorClass":"ConfigError","httpStatus":null,"severity":"error","filePath":"entity/configs/node/memory.py","lineNumber":448,"sourceCode":"    similarity_threshold: float = -1.0\n    read: bool = True\n    write: bool = True\n\n    @classmethod\n    def from_dict(cls, data: Mapping[str, Any], *, path: str) -> \"MemoryAttachmentConfig\":\n        mapping = require_mapping(data, path)\n        name = require_str(mapping, \"name\", path)\n\n        stages_raw = mapping.get(\"retrieve_stage\")\n        stages: List[AgentExecFlowStage] | None = None\n        if stages_raw is not None:\n            stage_list = ensure_list(stages_raw)\n            parsed: List[AgentExecFlowStage] = []\n            for idx, item in enumerate(stage_list):\n                try:\n                    parsed.append(AgentExecFlowStage(item))\n                except ValueError as exc:\n                    raise ConfigError(\n                        f\"retrieve_stage entries must be one of {[stage.value for stage in AgentExecFlowStage]}\",\n                        extend_path(path, f\"retrieve_stage[{idx}]\"),\n                    ) from exc\n            stages = parsed\n\n        top_k_value = mapping.get(\"top_k\", 3)\n        if not isinstance(top_k_value, int) or top_k_value <= 0:\n            raise ConfigError(\"top_k must be a positive integer\", extend_path(path, \"top_k\"))\n\n        threshold_value = mapping.get(\"similarity_threshold\", -1.0)\n        if not isinstance(threshold_value, (int, float)):\n            raise ConfigError(\"similarity_threshold must be numeric\", extend_path(path, \"similarity_threshold\"))\n\n        read_value = mapping.get(\"read\", True)\n        if not isinstance(read_value, bool):\n            raise ConfigError(\"read must be boolean\", extend_path(path, \"read\"))\n\n        write_value = mapping.get(\"write\", True)","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/entity/configs/node/memory.py#L430-L466","documentation":"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.","triggerScenarios":"Passing retrieve_stage: ['befor_llm'] (typo) or a stage name not in AgentExecFlowStage's values when parsing a memory retrieve config.","commonSituations":"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'.","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"],"exampleFix":"# before\nretrieve_stage:\n  - befor_llm\n# after\nretrieve_stage:\n  - before_llm","handlingStrategy":"validation","validationCode":"from entity... import AgentExecFlowStage\nvalid = {s.value for s in AgentExecFlowStage}\nassert all(str(x) in valid for x in cfg.get('retrieve_stage', []))","typeGuard":"def is_valid_stage(v) -> bool:\n    return v in {s.value for s in AgentExecFlowStage}","tryCatchPattern":"try:\n    cfg = MemoryRetrieveConfig.from_dict(data, path='retrieve')\nexcept ConfigError as e:\n    if 'retrieve_stage' in str(e):\n        cfg = MemoryRetrieveConfig.from_dict({**data, 'retrieve_stage': ['before_llm']}, path='retrieve')","preventionTips":["Pull allowed stage names from the enum, don't hardcode","Add config linting for enum fields"],"tags":["config","enum","memory","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}