{"record":{"id":"a9e078ff74e7a9b7","repo":"langgenius/dify","slug":"conversation-completed-a9e078","errorCode":"conversation_completed","errorMessage":"The conversation has ended. Please start a new conversation.","messagePattern":"The conversation has ended\\. Please start a new conversation\\.","errorType":"error_code","errorClass":"ConversationCompletedError","httpStatus":400,"severity":"error","filePath":"api/controllers/console/datasets/rag_pipeline/rag_pipeline_workflow.py","lineNumber":294,"sourceCode":"    @edit_permission_required\n    @rbac_permission_required(RBACResourceScope.DATASET, RBACPermission.DATASET_EDIT)\n    @model_validate(NodeRunPayload)\n    def post(self, req_data: NodeRunPayload, current_user: Account, pipeline: Pipeline, node_id: str):\n        \"\"\"\n        Run draft workflow iteration node\n        \"\"\"\n        args = req_data.model_dump(exclude_none=True)\n\n        try:\n            response = PipelineGenerateService.generate_single_iteration(\n                pipeline=pipeline, user=current_user, node_id=node_id, args=args, session=db.session(), 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 ValueError as e:\n            raise e\n        except Exception:\n            logging.exception(\"internal server error.\")\n            raise InternalServerError()\n\n\n@console_ns.route(\"/rag/pipelines/<uuid:pipeline_id>/workflows/draft/loop/nodes/<string:node_id>/run\")\nclass RagPipelineDraftRunLoopNodeApi(Resource):\n    @console_ns.expect(console_ns.models[NodeRunPayload.__name__])\n    @console_ns.response(200, \"Success\", console_ns.models[RagPipelineOpaqueResponse.__name__])\n    @setup_required\n    @login_required\n    @account_initialization_required\n    @edit_permission_required\n    @rbac_permission_required(RBACResourceScope.DATASET, RBACPermission.DATASET_EDIT)\n    @with_current_user\n    @get_rag_pipeline","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/datasets/rag_pipeline/rag_pipeline_workflow.py#L276-L312","documentation":"Returned (HTTP 400, error_code `conversation_completed`, 'The conversation has ended. Please start a new conversation.') by POST .../draft/iteration/nodes/<node_id>/run when the service raises `services.errors.conversation.ConversationCompletedError`. A conversation that has reached its terminal state cannot accept further node runs; the controller maps this to the typed ConversationCompletedError HTTP exception.","triggerScenarios":"Issuing an iteration run against a conversation that has already produced its final output; chaining runs after the conversation was marked complete; replaying a request after end-of-conversation.","commonSituations":"Workflow that emits a 'stop' or 'end' event then receives further iteration requests. UI allowing continued iteration after the conversation summary is shown. Backend that auto-completes conversations on a timer.","solutions":["Start a new conversation before issuing the next iteration run.","Detect the conversation completed event in the client and disable further iteration controls.","Clear conversation state when the end event arrives.","Design the workflow to keep the conversation open if continued iteration is intended."],"exampleFix":"// before\nif (conversationEnded) await runIteration(nodeId)\n// after\nif (conversationEnded) {\n  conversation = await createConversation()\n}\nawait runIteration(nodeId, conversation.id)","handlingStrategy":"try-catch","validationCode":"// client-side: stop issuing iteration runs after the conversation end event\nif (conversation.status === 'completed') {\n  conversation = await createConversation()\n}\nawait post(`${base}/draft/iteration/nodes/${nodeId}/run`, { conversation_id: conversation.id })","typeGuard":null,"tryCatchPattern":"try {\n  await post(`${base}/draft/iteration/nodes/${nodeId}/run`, payload)\n} catch (e) {\n  if (e.code === 'conversation_completed') {\n    // start a new conversation and retry once, or stop the workflow\n  } else throw e\n}","preventionTips":["Stop iteration after the conversation end event arrives.","Disable iteration controls on conversation completion.","Reset conversation state in the client when `conversation_completed` is received."],"tags":["rag-pipeline","iteration","conversation","lifecycle","api","rest"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}