{"record":{"id":"8bd9322f7a5c5275","repo":"langgenius/dify","slug":"app-not-found","errorCode":"app_not_found","errorMessage":"App not found.","messagePattern":"App not found\\.","errorType":"error_code","errorClass":"AppNotFoundError","httpStatus":404,"severity":"error","filePath":"api/controllers/console/app/agent_app_sandbox.py","lineNumber":371,"sourceCode":"    @setup_required\n    @login_required\n    @account_initialization_required\n    @with_current_user\n    @with_current_tenant_id\n    @model_validate(WorkflowAgentSandboxDownloadPayload)\n    def post(\n        self,\n        req_data: WorkflowAgentSandboxDownloadPayload,\n        tenant_id: str,\n        current_user: Account,\n        app_id: UUID,\n        workflow_run_id: UUID,\n        node_id: str,\n    ):\n        service = WorkflowAgentSandboxService()\n        resolved_app_id = service.resolve_app_id(tenant_id=tenant_id, app_id=str(app_id))\n        if resolved_app_id is None:\n            raise AppNotFoundError()\n        try:\n            result = service.download_file(\n                tenant_id=tenant_id,\n                app_id=resolved_app_id,\n                workflow_run_id=str(workflow_run_id),\n                node_id=node_id,\n                node_execution_id=req_data.node_execution_id,\n                account_id=current_user.id,\n                path=req_data.path,\n            )\n        except Exception as exc:\n            return _handle(exc)\n        return result.model_dump()\n","sourceCodeStart":353,"sourceCodeEnd":385,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/app/agent_app_sandbox.py#L353-L385","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the app_id exists for the current tenant and reload the workflow run context in the UI.","If the app was deleted, re-run the workflow from an existing app or restore the app.","Ensure the calling account has access to the tenant that owns the app.","For hidden-app-backed Agents, confirm roster_service.runtime_backing_app_id still resolves to a live app."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from services.workflow_agent_sandbox import WorkflowAgentSandboxService\n\ndef app_resolves_for_sandbox(tenant_id: str, app_id: str) -> bool:\n    return WorkflowAgentSandboxService().resolve_app_id(tenant_id=tenant_id, app_id=app_id) is not None","typeGuard":null,"tryCatchPattern":"from services.errors.app import AppNotFoundError\n\ntry:\n    download = client.post(sandbox_url, json=payload)\nexcept AppNotFoundError:\n    # app_id not resolvable for tenant: reload context\n    raise","preventionTips":["Refresh the workflow run context in the UI before offering sandbox downloads.","Confirm the app_id belongs to the caller's tenant.","For hidden-app-backed Agents, verify the runtime backing app still exists."],"tags":["sandbox","app-not-found","workflow","tenant-scope"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}