langgenius/dify · error · ConversationCompletedError
conversation_completed
conversation_completed
Error message
The conversation has ended. Please start a new conversation.
What it means
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.
Source
Thrown at api/controllers/console/datasets/rag_pipeline/rag_pipeline_workflow.py:294
@edit_permission_required
@rbac_permission_required(RBACResourceScope.DATASET, RBACPermission.DATASET_EDIT)
@model_validate(NodeRunPayload)
def post(self, req_data: NodeRunPayload, current_user: Account, pipeline: Pipeline, node_id: str):
"""
Run draft workflow iteration node
"""
args = req_data.model_dump(exclude_none=True)
try:
response = PipelineGenerateService.generate_single_iteration(
pipeline=pipeline, user=current_user, node_id=node_id, args=args, session=db.session(), streaming=True
)
return helper.compact_generate_response(response)
except services.errors.conversation.ConversationNotExistsError:
raise NotFound("Conversation Not Exists.")
except services.errors.conversation.ConversationCompletedError:
raise ConversationCompletedError()
except ValueError as e:
raise e
except Exception:
logging.exception("internal server error.")
raise InternalServerError()
@console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/loop/nodes/<string:node_id>/run")
class RagPipelineDraftRunLoopNodeApi(Resource):
@console_ns.expect(console_ns.models[NodeRunPayload.__name__])
@console_ns.response(200, "Success", console_ns.models[RagPipelineOpaqueResponse.__name__])
@setup_required
@login_required
@account_initialization_required
@edit_permission_required
@rbac_permission_required(RBACResourceScope.DATASET, RBACPermission.DATASET_EDIT)
@with_current_user
@get_rag_pipelineView on GitHub (pinned to ef8544b173)
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.
Example fix
// before
if (conversationEnded) await runIteration(nodeId)
// after
if (conversationEnded) {
conversation = await createConversation()
}
await runIteration(nodeId, conversation.id) Defensive patterns
Strategy: try-catch
Validate before calling
// client-side: stop issuing iteration runs after the conversation end event
if (conversation.status === 'completed') {
conversation = await createConversation()
}
await post(`${base}/draft/iteration/nodes/${nodeId}/run`, { conversation_id: conversation.id }) Try / catch
try {
await post(`${base}/draft/iteration/nodes/${nodeId}/run`, payload)
} catch (e) {
if (e.code === 'conversation_completed') {
// start a new conversation and retry once, or stop the workflow
} else throw e
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Conversation Not Exists.
- Internal Server Error
- expected dict for file, got {type(raw_value)}
- expected list for files, got {type(raw_value)}
- expected dict for files[0], got {type(raw_value)}
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/a9e078ff74e7a9b7.
Report an issue: GitHub.