{"record":{"id":"4b31376c58cb9438","repo":"langgenius/dify","slug":"agent-not-found-4b3137","errorCode":null,"errorMessage":"Agent not found.","messagePattern":"Agent not found\\.","errorType":"http","errorClass":"AgentNotFoundError","httpStatus":404,"severity":"error","filePath":"api/controllers/console/app/completion.py","lineNumber":364,"sourceCode":"\ndef _resolve_current_user_agent_debug_conversation_id(\n    *,\n    session: Session,\n    current_tenant_id: str,\n    current_user: Account,\n    app_model: App,\n    agent_id: str | None,\n    draft_type: AgentConfigDraftType,\n    start_new: bool = False,\n) -> str:\n    \"\"\"Resolve the current editor's Build or Preview conversation.\"\"\"\n\n    roster_service = AgentRosterService(session)\n    resolved_agent_id = agent_id\n    if not resolved_agent_id:\n        agent = roster_service.get_app_backing_agent(tenant_id=current_tenant_id, app_id=str(app_model.id))\n        if agent is None:\n            raise AgentNotFoundError()\n        resolved_agent_id = agent.id\n\n    if draft_type == AgentConfigDraftType.DEBUG_BUILD:\n        return roster_service.get_or_create_build_conversation(\n            tenant_id=current_tenant_id,\n            agent_id=resolved_agent_id,\n            account_id=current_user.id,\n        )\n    if start_new:\n        return roster_service.rotate_preview_conversation(\n            tenant_id=current_tenant_id,\n            agent_id=resolved_agent_id,\n            account_id=current_user.id,\n        )\n    conversation_id = roster_service.get_current_preview_conversation(\n        tenant_id=current_tenant_id,\n        agent_id=resolved_agent_id,\n        account_id=current_user.id,","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/app/completion.py#L346-L382","documentation":"Error \"Agent not found.\" thrown in langgenius/dify.","triggerScenarios":"Thrown at api/controllers/console/app/completion.py:364 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}