{"record":{"id":"87e88d77f0858108","repo":"langgenius/dify","slug":"conversation-not-exists-87e88d","errorCode":null,"errorMessage":"Conversation Not Exists.","messagePattern":"Conversation Not Exists\\.","errorType":"http","errorClass":"NotFound","httpStatus":404,"severity":"warning","filePath":"api/controllers/console/app/workflow.py","lineNumber":726,"sourceCode":"        args = args_model.model_dump(exclude_none=True)\n\n        external_trace_id = get_external_trace_id(request)\n        if external_trace_id:\n            args[\"external_trace_id\"] = external_trace_id\n\n        try:\n            response = AppGenerateService.generate(\n                session=session,\n                app_model=app_model,\n                user=current_user,\n                args=args,\n                invoke_from=InvokeFrom.DEBUGGER,\n                streaming=True,\n            )\n\n            return helper.compact_generate_response(response)\n        except services.errors.conversation.ConversationNotExistsError:\n            raise NotFound(\"Conversation Not Exists.\")\n        except services.errors.conversation.ConversationCompletedError:\n            raise ConversationCompletedError()\n        except InvokeRateLimitError as ex:\n            raise InvokeRateLimitHttpError(ex.description)\n        except ValueError as e:\n            raise e\n        except Exception:\n            logger.exception(\"internal server error.\")\n            raise InternalServerError()\n\n\n@console_ns.route(\"/apps/<uuid:app_id>/advanced-chat/workflows/draft/iteration/nodes/<string:node_id>/run\")\nclass AdvancedChatDraftRunIterationNodeApi(Resource):\n    @console_ns.doc(\"run_advanced_chat_draft_iteration_node\")\n    @console_ns.doc(description=\"Run draft workflow iteration node for advanced chat\")\n    @console_ns.doc(params={\"app_id\": \"Application ID\", \"node_id\": \"Node ID\"})\n    @console_ns.expect(console_ns.models[IterationNodeRunPayload.__name__])\n    @console_ns.response(","sourceCodeStart":708,"sourceCodeEnd":744,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/app/workflow.py#L708-L744","documentation":"Raised as NotFound('Conversation Not Exists.') in AdvancedChatDraftWorkflowRunApi.post when AppGenerateService.generate raises services.errors.conversation.ConversationNotExistsError (api/controllers/console/app/workflow.py:725-726). The supplied conversation_id does not correspond to an existing conversation for the app, so the advanced-chat draft run cannot continue.","triggerScenarios":"POSTing /apps/{app_id}/advanced-chat/workflows/draft/run with a conversation_id that does not exist or does not belong to the app. The generate path loads the conversation and fails.","commonSituations":"Stale conversation_id from a deleted/ended conversation; conversation_id from a different app; UUID typo; conversation purged by retention; front-end not clearing conversation_id after the thread was removed.","solutions":["Omit conversation_id (or send null) to start a new conversation for the draft run.","If continuing an existing thread, obtain a fresh conversation_id from the conversation list for the app.","Clear the front-end conversation state when a conversation is deleted or completed."],"exampleFix":"// before: sending a stale conversation id\n{query:'hi', conversation_id: oldId}\n// after: start fresh when in doubt\n{query:'hi', conversation_id: null}","handlingStrategy":"validation","validationCode":"// Validate conversation_id before the draft run\nasync function conversationExists(appId, convId) {\n  if (!convId) return true // new conversation\n  const res = await fetch(`/apps/${appId}/conversations`)\n  const list = await res.json()\n  return list.data.some(c => c.id === convId)\n}\nif (!(await conversationExists(appId, payload.conversation_id))) payload.conversation_id = null","typeGuard":null,"tryCatchPattern":"try {\n  return await runDraft(appId, payload)\n} catch (e) {\n  if (e.status === 404 && /Conversation Not Exists/.test(e.message)) {\n    payload.conversation_id = null; return runDraft(appId, payload)\n  }\n  throw e\n}","preventionTips":["Clear conversation_id when the thread is deleted.","Pull conversation_id from a freshly loaded list.","Fall back to a new conversation on 404."],"tags":["workflow","advanced-chat","conversation","not-found","api"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}