bytedance/deer-flow · critical · ValueError
No chat model could be resolved. Please configure at least o
Error message
No chat model could be resolved. Please configure at least one model in config.yaml or provide a valid 'model_name'/'model' in the request.
What it means
ValueError at the end of agent creation: after name resolution and authorization fallback, app_config.get_model_config(model_name) still returned None. This means the resolved/authorized model name is not in the config's model list — possible when authorization fell back to a name that exists in the policy but not in config.yaml, or config changed between resolution and lookup.
Source
Thrown at backend/packages/harness/deerflow/agents/lead_agent/agent.py:747
thinking_enabled = bool(_resolve_runtime_option(cfg, "thinking_enabled", agent_thinking, True))
reasoning_effort = _resolve_runtime_option(cfg, "reasoning_effort", agent_reasoning, None)
# Per-agent sampling overrides (temperature / max_tokens) layered on top of
# the resolved model profile (issue #4336). None when the agent set none.
agent_model_settings = getattr(agent_config, "model_settings", None) if agent_config else None
agent_model_overrides = agent_model_settings.model_dump(exclude_none=True) if agent_model_settings else None
# Final model name resolution: request → agent config → global default, with fallback for unknown names
model_name = _resolve_model_name(requested_model_name or agent_model_name, app_config=resolved_app_config)
# Phase 3: enforce model:use authorization. On deny, fall back to the first
# allowed model (graceful) rather than crashing the run (RFC §9).
model_name = _authorize_model_name(model_name, context=cfg, app_config=resolved_app_config)
model_config = resolved_app_config.get_model_config(model_name)
if model_config is None:
raise ValueError("No chat model could be resolved. Please configure at least one model in config.yaml or provide a valid 'model_name'/'model' in the request.")
if thinking_enabled and not model_config.supports_thinking:
logger.warning(f"Thinking mode is enabled but model '{model_name}' does not support it; fallback to non-thinking mode.")
thinking_enabled = False
logger.info(
"Create Agent(%s) -> thinking_enabled: %s, reasoning_effort: %s, model_name: %s, is_plan_mode: %s, subagent_enabled: %s, max_concurrent_subagents: %s, max_total_subagents: %s",
agent_name or "default",
thinking_enabled,
reasoning_effort,
model_name,
is_plan_mode,
subagent_enabled,
max_concurrent_subagents,
max_total_subagents,
)
# Inject run metadata for LangSmith trace tagging
if "metadata" not in config:View on GitHub (pinned to 1dd6ba1acb)
Solutions
- Align the RBAC/authz model allowlist with config.yaml models: every policy-visible model must have a config entry.
- Ensure config.yaml defines at least one model (see error 465) and that the default model exists.
- Pass an explicit valid model_name/'model' in the request context.
- After any config.yaml change, restart the Gateway so resolution and lookups see one consistent AppConfig.
Example fix
# policy allows: ["llama-3"] but config.yaml lacks it
# before (config.yaml)
models:
- name: gpt-4o
# after
models:
- name: gpt-4o
- name: llama-3
provider: ollama Defensive patterns
Strategy: validation
Validate before calling
cfg = get_app_config() allowed_by_policy = set(provider.filter_resources(principal, 'model', [m.name for m in cfg.models])) usable = [m.name for m in cfg.models if m.name in allowed_by_policy] assert usable, 'policy and config.yaml disagree: no model is both configured and authorized'
Try / catch
try:
agent = create_agent(...)
except ValueError as e:
if 'No chat model could be resolved' in str(e):
# check policy/config drift: re-sync authz allowlist with config.yaml models, then retry
sync_policy_with_config_models(); agent = create_agent(...)
raise Prevention
- Keep RBAC model lists and config.yaml models generated from one source of truth.
- Add a startup check: intersection of policy-allowed and configured models is non-empty.
- Restart Gateway after config model changes to avoid partial-reload races.
When it happens
Trigger: authz fallback returns a candidate model name that the RBAC policy allows but config.yaml does not define; or a race where the AppConfig is swapped mid-run (hot config reload) so get_model_config misses.
Common situations: RBAC policy lists models that were never added to config.yaml (policy/config drift); config reloaded with a trimmed models list while old policy still references removed names; default model deleted from config after the policy was written.
Related errors
- No chat models are configured. Please configure at least one
- No models are authorized for the current role (authorization
- Model {model_name!r} is not in the configured model allowlis
- No models are authorized for the current role.
- Failed to load MCP configuration
AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14).
Data as JSON: /api/errors/a23d02489ce99a8a.
Report an issue: GitHub.