{"record":{"id":"db837bf42c2e38ca","repo":"OpenBMB/ChatDev","slug":"model-input-mode-must-be-prompt-or-messages","errorCode":null,"errorMessage":"model.input_mode must be 'prompt' or 'messages'","messagePattern":"model\\.input_mode must be 'prompt' or 'messages'","errorType":"validation","errorClass":"ConfigError","httpStatus":null,"severity":"error","filePath":"entity/configs/node/agent.py","lineNumber":361,"sourceCode":"        mapping = require_mapping(data, path)\n        provider = require_str(mapping, \"provider\", path)\n        base_url = optional_str(mapping, \"base_url\", path)\n        name_value = mapping.get(\"name\")\n        if isinstance(name_value, str) and name_value.strip():\n            model_name = name_value.strip()\n        else:\n            raise ConfigError(\"model.name must be a non-empty string\", extend_path(path, \"name\"))\n\n        role = optional_str(mapping, \"role\", path)\n        api_key = optional_str(mapping, \"api_key\", path)\n        params = optional_dict(mapping, \"params\", path) or {}\n        raw_input_mode = optional_str(mapping, \"input_mode\", path)\n        input_mode = AgentInputMode.MESSAGES\n        if raw_input_mode:\n            try:\n                input_mode = AgentInputMode(raw_input_mode.strip().lower())\n            except ValueError as exc:\n                raise ConfigError(\n                    \"model.input_mode must be 'prompt' or 'messages'\",\n                    extend_path(path, \"input_mode\"),\n                ) from exc\n\n        tooling_cfg: List[ToolingConfig] = []\n        if \"tooling\" in mapping and mapping[\"tooling\"] is not None:\n            raw_tooling = mapping[\"tooling\"]\n            if not isinstance(raw_tooling, list):\n                 raise ConfigError(\"tooling must be a list\", extend_path(path, \"tooling\"))\n            for idx, item in enumerate(raw_tooling):\n                tooling_cfg.append(\n                    ToolingConfig.from_dict(item, path=extend_path(path, f\"tooling[{idx}]\"))\n                )\n\n        thinking_cfg = None\n        if \"thinking\" in mapping and mapping[\"thinking\"] is not None:\n            thinking_cfg = ThinkingConfig.from_dict(mapping[\"thinking\"], path=extend_path(path, \"thinking\"))\n","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/OpenBMB/ChatDev/blob/4fb2db0ea90375ce1059f44fe03ffbd191a7a169/entity/configs/node/agent.py#L343-L379","documentation":"The optional 'input_mode' field of an agent's model config could not be mapped to the AgentInputMode enum. Only 'prompt' (single string input) and 'messages' (structured chat messages, the default) are accepted; matching is case-insensitive after stripping.","triggerScenarios":"Setting model.input_mode to anything other than 'prompt' or 'messages' (case-insensitive), e.g. 'chat', 'text', 'completion', or a typo like 'promt'. Absent/null input_mode is fine and defaults to MESSAGES.","commonSituations":"Copy-pasting configs from other agent frameworks that use 'chat'/'text' modes; typos; version changes where old mode names were removed.","solutions":["Set input_mode to exactly 'prompt' or 'messages' (any casing works since it is lowered)","Omit input_mode entirely if you want the default 'messages' behavior","Search your config source for the bad literal using the error's path"],"exampleFix":"// before\n{\"input_mode\": \"chat\"}\n// after\n{\"input_mode\": \"prompt\"}","handlingStrategy":"type-guard","validationCode":"ALLOWED_MODES = {'prompt', 'messages'}\nmode = (cfg.get('model', {}).get('input_mode') or 'messages').strip().lower()\nif mode not in ALLOWED_MODES:\n    cfg['model']['input_mode'] = 'messages'","typeGuard":"def valid_input_mode(cfg: dict) -> bool:\n    m = cfg.get('model', {}).get('input_mode')\n    return m is None or (isinstance(m, str) and m.strip().lower() in {'prompt', 'messages'})","tryCatchPattern":"try:\n    ModelConfig.from_dict(data, path='agent')\nexcept ConfigError as e:\n    if 'input_mode' in e.path:\n        data['model'].pop('input_mode', None)  # fall back to default\n        ModelConfig.from_dict(data, path='agent')\n    else:\n        raise","preventionTips":["Normalize case and strip whitespace before setting input_mode","Expose only a two-option dropdown in UIs that author agent configs","Omit the key when unsure — default is 'messages'"],"tags":["config","agent","enum","validation","python"],"backgroundTag":"invalid-enum-value","analyzedSha":"4fb2db0ea90375ce1059f44fe03ffbd191a7a169","analyzedAt":"2026-08-27T14:35:29.622Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}