{"record":{"id":"c429619c5cd6839f","repo":"bytedance/deer-flow","slug":"agent-name-not-found-c42961","errorCode":null,"errorMessage":"Agent '{name}' not found","messagePattern":"Agent '(.+?)' not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"backend/app/gateway/routers/agents.py","lineNumber":288,"sourceCode":"        Agent details including SOUL.md content.\n\n    Raises:\n        HTTPException: 404 if agent not found.\n    \"\"\"\n    _require_agents_api_enabled()\n    _validate_agent_name(name)\n    name = _normalize_agent_name(name)\n    user_id = get_effective_user_id()\n\n    def _get() -> AgentResponse:\n        # Worker thread: config read + SOUL read must stay off the event loop.\n        agent_cfg = load_agent_config(name, user_id=user_id)\n        return _agent_config_to_response(agent_cfg, include_soul=True, user_id=user_id)\n\n    try:\n        return await asyncio.to_thread(_get)\n    except FileNotFoundError:\n        raise HTTPException(status_code=404, detail=f\"Agent '{name}' not found\")\n    except Exception as e:\n        logger.error(f\"Failed to get agent '{name}': {e}\", exc_info=True)\n        raise HTTPException(status_code=500, detail=f\"Failed to get agent: {str(e)}\")\n\n\n@router.post(\n    \"/agents\",\n    response_model=AgentResponse,\n    status_code=201,\n    summary=\"Create Custom Agent\",\n    description=\"Create a new custom agent with its config and SOUL.md.\",\n)\nasync def create_agent_endpoint(request: AgentCreateRequest) -> AgentResponse:\n    \"\"\"Create a new custom agent.\n\n    Args:\n        request: The agent creation request.\n","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/agents.py#L270-L306","documentation":"404 from GET `/agents/{name}`: name passed validation, but `load_agent_config` raised `FileNotFoundError` — no config exists for that (lowercased) name scoped to the current effective user. Names are normalized to lowercase before lookup, so 'MyAgent' and 'myagent' share one namespace.","triggerScenarios":"GET `/agents/foo` after the agent was deleted; fetching an agent created by a different user_id (per-user isolation); requesting a name whose stored casing differs — lookup is case-insensitive via normalization, so this indicates genuine absence, not casing; stale frontend list after another tab deleted the agent.","commonSituations":"Out-of-date agent pickers; switching logged-in user and expecting to see another user's agents; delete-then-navigate races in the UI.","solutions":["Re-list agents (GET `/agents`) to see what actually exists for this user","If the agent should exist, confirm you are authenticated as the user who created it","Handle 404 in the UI by refreshing the agent list and removing dead references"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const existing = (await api.listAgents()).agents.map((a) => a.name);\nif (!existing.includes(name.toLowerCase())) {\n  // don't call GET — refresh the list instead\n}","typeGuard":null,"tryCatchPattern":"try { return await api.getAgent(name); }\ncatch (e) {\n  if (e.status === 404) { await refreshAgentList(); return null; }\n  throw e;\n}","preventionTips":["Lowercase agent names client-side to match server normalization","On any 404, refresh the cached agent list rather than retrying","Remember agent visibility is per-user — switching accounts invalidates the cache"],"tags":["http-404","agents","user-isolation","not-found"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}