langgenius/dify · error · AppNotFoundError

app_not_found

app_not_found

Error message

App not found.

What it means

Raised as AppNotFoundError (code=app_not_found, HTTP 404) from the workflow agent sandbox download endpoint: WorkflowAgentSandboxService.resolve_app_id(tenant_id, app_id) returned None, meaning no app matching that id is visible to the tenant. The endpoint refuses to issue a sandbox download URL for an app it cannot resolve.

Source

Thrown at api/controllers/console/app/agent_app_sandbox.py:371

    @setup_required
    @login_required
    @account_initialization_required
    @with_current_user
    @with_current_tenant_id
    @model_validate(WorkflowAgentSandboxDownloadPayload)
    def post(
        self,
        req_data: WorkflowAgentSandboxDownloadPayload,
        tenant_id: str,
        current_user: Account,
        app_id: UUID,
        workflow_run_id: UUID,
        node_id: str,
    ):
        service = WorkflowAgentSandboxService()
        resolved_app_id = service.resolve_app_id(tenant_id=tenant_id, app_id=str(app_id))
        if resolved_app_id is None:
            raise AppNotFoundError()
        try:
            result = service.download_file(
                tenant_id=tenant_id,
                app_id=resolved_app_id,
                workflow_run_id=str(workflow_run_id),
                node_id=node_id,
                node_execution_id=req_data.node_execution_id,
                account_id=current_user.id,
                path=req_data.path,
            )
        except Exception as exc:
            return _handle(exc)
        return result.model_dump()

View on GitHub (pinned to ef8544b173)

Solutions

  1. Verify the app_id exists for the current tenant and reload the workflow run context in the UI.
  2. If the app was deleted, re-run the workflow from an existing app or restore the app.
  3. Ensure the calling account has access to the tenant that owns the app.
  4. For hidden-app-backed Agents, confirm roster_service.runtime_backing_app_id still resolves to a live app.
Defensive patterns

Strategy: validation

Validate before calling

from services.workflow_agent_sandbox import WorkflowAgentSandboxService

def app_resolves_for_sandbox(tenant_id: str, app_id: str) -> bool:
    return WorkflowAgentSandboxService().resolve_app_id(tenant_id=tenant_id, app_id=app_id) is not None

Try / catch

from services.errors.app import AppNotFoundError

try:
    download = client.post(sandbox_url, json=payload)
except AppNotFoundError:
    # app_id not resolvable for tenant: reload context
    raise

Prevention

When it happens

Trigger: POST /console/.../apps/<app_id>/workflow-runs/<workflow_run_id>/nodes/<node_id>/sandbox/download with an app_id that does not exist in the tenant, was deleted, or belongs to another tenant. Also when the backing app resolution for a hidden-app-backed Agent cannot find the runtime app.

Common situations: Stale client holding a deleted app_id; cross-tenant access attempt; app_id from a different environment; the runtime backing app for an Agent was removed while the Agent still references it.

Related errors


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