{"record":{"id":"1cb30c1f00a395cd","repo":"bytedance/deer-flow","slug":"failed-to-get-agent-str-e","errorCode":null,"errorMessage":"Failed to get agent: {str(e)}","messagePattern":"Failed to get agent: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"backend/app/gateway/routers/agents.py","lineNumber":291,"sourceCode":"        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\n    Returns:\n        The created agent details.\n","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/app/gateway/routers/agents.py#L273-L309","documentation":"Catch-all 500 on GET `/agents/{name}`: the config was found (`FileNotFoundError` is handled separately as 404) but something during load or SOUL enrichment failed — e.g. config.yaml present but invalid, or the SOUL.md read raised a non-FileNotFoundError IO error. The real traceback is in the logs via `exc_info=True`.","triggerScenarios":"A `config.yaml` that exists but fails schema validation or YAML parsing; permission denied reading SOUL.md; DB-backed store raising a data error after the row was found.","commonSituations":"Corrupted half-written config files (crash during a previous create/update); manual edits introducing invalid fields; permission changes on the data directory.","solutions":["Read the Gateway log traceback to identify whether config parse or SOUL read failed","Open the agent's config.yaml on disk and fix or delete-and-recreate it","Restore correct file permissions on the agent directory","For DB backends, inspect the agent row for truncated/invalid payload"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return await api.getAgent(name); }\ncatch (e) {\n  if (e.status === 404) return null;               // absent\n  if (e.status === 500) throw new CorruptAgentError(name, e.detail); // present but unreadable\n  throw e;\n}","preventionTips":["Distinguish 404 (absent) from 500 (corrupt) in error handling — they need different UX","Back up agent config files before bulk edits","Alert on 500s from GET /agents — they usually mean on-disk corruption"],"tags":["http-500","agents","corrupt-config","filesystem"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}