langgenius/dify · error · AgentNotFoundError

Agent not found.

Error message

Agent not found.

What it means

Error "Agent not found." thrown in langgenius/dify.

Source

Thrown at api/controllers/console/app/completion.py:364

def _resolve_current_user_agent_debug_conversation_id(
    *,
    session: Session,
    current_tenant_id: str,
    current_user: Account,
    app_model: App,
    agent_id: str | None,
    draft_type: AgentConfigDraftType,
    start_new: bool = False,
) -> str:
    """Resolve the current editor's Build or Preview conversation."""

    roster_service = AgentRosterService(session)
    resolved_agent_id = agent_id
    if not resolved_agent_id:
        agent = roster_service.get_app_backing_agent(tenant_id=current_tenant_id, app_id=str(app_model.id))
        if agent is None:
            raise AgentNotFoundError()
        resolved_agent_id = agent.id

    if draft_type == AgentConfigDraftType.DEBUG_BUILD:
        return roster_service.get_or_create_build_conversation(
            tenant_id=current_tenant_id,
            agent_id=resolved_agent_id,
            account_id=current_user.id,
        )
    if start_new:
        return roster_service.rotate_preview_conversation(
            tenant_id=current_tenant_id,
            agent_id=resolved_agent_id,
            account_id=current_user.id,
        )
    conversation_id = roster_service.get_current_preview_conversation(
        tenant_id=current_tenant_id,
        agent_id=resolved_agent_id,
        account_id=current_user.id,

View on GitHub (pinned to ef8544b173)

When it happens

Trigger: Thrown at api/controllers/console/app/completion.py:364 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/4b31376c58cb9438. Report an issue: GitHub.