{"record":{"id":"14123b5f4a6cda87","repo":"bytedance/deer-flow","slug":"no-chat-models-are-configured-please-configure-at","errorCode":null,"errorMessage":"No chat models are configured. Please configure at least one model in config.yaml.","messagePattern":"No chat models are configured\\. Please configure at least one model in config\\.yaml\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"backend/packages/harness/deerflow/agents/lead_agent/agent.py","lineNumber":133,"sourceCode":"        tools.append(memory_tool)\n        existing_names.add(memory_tool.name)\n\n\ndef _get_runtime_config(config: RunnableConfig) -> dict:\n    \"\"\"Merge legacy configurable options with LangGraph runtime context.\"\"\"\n    cfg = dict(config.get(\"configurable\", {}) or {})\n    context = config.get(\"context\", {}) or {}\n    if isinstance(context, dict):\n        cfg.update(context)\n    return cfg\n\n\ndef _resolve_model_name(requested_model_name: str | None = None, *, app_config: AppConfig | None = None) -> str:\n    \"\"\"Resolve a runtime model name safely, falling back to default if invalid. Returns None if no models are configured.\"\"\"\n    app_config = app_config or get_app_config()\n    default_model_name = app_config.models[0].name if app_config.models else None\n    if default_model_name is None:\n        raise ValueError(\"No chat models are configured. Please configure at least one model in config.yaml.\")\n\n    if requested_model_name and app_config.get_model_config(requested_model_name):\n        return requested_model_name\n\n    if requested_model_name and requested_model_name != default_model_name:\n        logger.warning(f\"Model '{requested_model_name}' not found in config; fallback to default model '{default_model_name}'.\")\n    return default_model_name\n\n\ndef _authorize_model_name(\n    model_name: str,\n    *,\n    context: Mapping[str, Any],\n    app_config: AppConfig,\n) -> str:\n    \"\"\"Enforce ``model:use`` authorization on the resolved model name.\n\n    When ``authorization.enabled`` is false this is a no-op (returns","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/lead_agent/agent.py#L115-L151","documentation":"ValueError from _resolve_model_name in the lead agent: app_config.models is empty, so there is no default model to fall back to. The agent refuses to build rather than running modelless. This is a configuration error — config.yaml has zero entries under models.","triggerScenarios":"Any agent/run creation when config.yaml (or the resolved AppConfig) contains no models: empty models list, failed config load falling through to defaults, or a config override wiping the list.","commonSituations":"Fresh clone where config.yaml was copied from example but models section left empty; CI/test environment without model config; typo in YAML indentation making models parse as a scalar; config API PATCH that replaced models with [].","solutions":["Add at least one full model entry under models: in config.yaml and restart the Gateway.","Validate config with `make doctor` (or the config validation endpoint) to catch YAML structure errors.","If config is managed via API, re-fetch it and confirm models is a non-empty list.","For tests, inject an AppConfig stub with at least one model instead of relying on global config."],"exampleFix":"# config.yaml\n# before\nmodels: []\n\n# after\nmodels:\n  - name: gpt-4o\n    provider: openai\n    api_key: ${OPENAI_API_KEY}","handlingStrategy":"validation","validationCode":"from deerflow.config import get_app_config\ncfg = get_app_config()\nassert cfg.models, 'config.yaml has no models configured — agent creation will fail'","typeGuard":"def has_model(cfg) -> bool:\n    return bool(getattr(cfg, 'models', None)) and all(getattr(m, 'name', None) for m in cfg.models)","tryCatchPattern":"try:\n    agent = create_agent(...)\nexcept ValueError as e:\n    if 'No chat models are configured' in str(e):\n        raise SystemExit('Fix config.yaml: add at least one model entry') from e\n    raise","preventionTips":["Run `make doctor` after config changes.","Fail startup early: validate models non-empty at Gateway boot, not at first run.","Add a config schema test in CI that loads the example config and asserts models is non-empty."],"tags":["config","model","startup","valueerror"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}