{"record":{"id":"2a8f7a2125e84ccf","repo":"ZhuLinsen/daily_stock_analysis","slug":"unsupported-agent-arch","errorCode":"unsupported_agent_arch","errorMessage":"Codex Agent currently supports single-agent Chat only","messagePattern":"Codex Agent currently supports single-agent Chat only","errorType":"http","errorClass":"AgentBackendConfigError","httpStatus":400,"severity":"error","filePath":"src/agent/factory.py","lineNumber":402,"sourceCode":"\ndef build_agent_chat_executor(config=None, skills: Optional[List[str]] = None):\n    \"\"\"Build the backend-neutral executor used only by Agent Chat endpoints.\"\"\"\n    if config is None:\n        from src.config import get_config\n\n        config = get_config()\n\n    from src.agent.agent_backend import (\n        AgentBackendConfigError,\n        LiteLLMAgentBackend,\n        resolve_agent_backend_id,\n    )\n    from src.agent.chat_executor import AgentChatExecutor\n\n    backend_id = resolve_agent_backend_id(config)\n    arch = str(getattr(config, \"agent_arch\", \"single\") or \"single\").strip().lower()\n    if backend_id == \"codex_app_server\" and arch != \"single\":\n        raise AgentBackendConfigError(\n            \"unsupported_agent_arch\",\n            \"Codex Agent currently supports single-agent Chat only\",\n        )\n    if backend_id == \"litellm\" and arch == \"multi\":\n        return build_agent_executor(config, skills=skills)\n\n    registry = get_tool_registry()\n    prompt_state = resolve_skill_prompt_state(config, skills=skills)\n    if backend_id == \"litellm\":\n        from src.agent.llm_adapter import LLMToolAdapter\n\n        context_llm_adapter = LLMToolAdapter(config)\n        backend = LiteLLMAgentBackend(registry, context_llm_adapter)\n    else:\n        from src.agent.codex_agent_backend import CodexAgentBackend\n        from src.agent.tool_surface import ToolSurface\n\n        context_llm_adapter = None","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/ZhuLinsen/daily_stock_analysis/blob/5159bd72e8373d215492dff122acc9d389e219c9/src/agent/factory.py#L384-L420","documentation":"AgentBackendConfigError (code 'unsupported_agent_arch') raised in the agent factory when the resolved backend is codex_app_server but config.agent_arch is not 'single'. The Codex App-Server backend implements only the single-agent chat flow, so requesting 'multi' (or any other arch value) with that backend is a configuration contradiction that fails fast at executor construction.","triggerScenarios":"Building the agent executor while AGENT_BACKEND/codex_app_server is the resolved backend id and agent_arch is set to 'multi' (or any string other than 'single' after strip/lower). With backend 'litellm' and arch 'multi' a different executor is built instead, so the error is specific to the codex_app_server + non-single combination.","commonSituations":"Env files copied between deployments that mix a Codex backend with multi-agent settings; enabling multi-agent orchestration while an experimental Codex backend flag is still on; defaulting agent_arch to something nonstandard in a shared config template.","solutions":["Set agent_arch to 'single' (or remove it so the 'single' default applies) when using the codex_app_server backend.","Or switch the backend away from codex_app_server (e.g. to litellm) if you need multi-agent mode.","Audit .env / config for contradictory pairs (backend id vs agent_arch) at startup and fail with a clear message before any agent runs."],"exampleFix":"# before (.env)\nAGENT_BACKEND=codex_app_server\nAGENT_ARCH=multi\n\n# after\nAGENT_BACKEND=codex_app_server\nAGENT_ARCH=single","handlingStrategy":"validation","validationCode":"def agent_config_is_consistent(config) -> bool:\n    arch = str(getattr(config, \"agent_arch\", \"single\") or \"single\").strip().lower()\n    backend = str(getattr(config, \"agent_backend\", \"litellm\")).strip().lower()\n    return not (backend == \"codex_app_server\" and arch != \"single\")","typeGuard":null,"tryCatchPattern":"from src.agent.agent_backend import AgentBackendConfigError\n\ntry:\n    executor = build_executor(config)\nexcept AgentBackendConfigError as e:\n    if e.error_code == \"unsupported_agent_arch\":\n        config.agent_arch = \"single\"  # or surface a config UI error\n        executor = build_executor(config)","preventionTips":["Document that codex_app_server implies agent_arch=single.","Add a startup config lint for backend/arch contradictions.","Keep environment-specific .env files from mixing experimental backend flags with multi-agent settings."],"tags":["configuration","agent","backend","architecture"],"backgroundTag":null,"analyzedSha":"5159bd72e8373d215492dff122acc9d389e219c9","analyzedAt":"2026-08-15T01:59:36.292Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}