langgenius/dify · warning · ConversationCompletedError
conversation_completed
conversation_completed
Error message
The conversation has ended. Please start a new conversation.
What it means
Raised as ConversationCompletedError in AdvancedChatDraftWorkflowRunApi.post when AppGenerateService.generate raises services.errors.conversation.ConversationCompletedError (api/controllers/console/app/workflow.py:727-728). The referenced conversation has reached a terminal/completed state and no further messages can be appended to it; a new conversation must be started.
Source
Thrown at api/controllers/console/app/workflow.py:728
external_trace_id = get_external_trace_id(request)
if external_trace_id:
args["external_trace_id"] = external_trace_id
try:
response = AppGenerateService.generate(
session=session,
app_model=app_model,
user=current_user,
args=args,
invoke_from=InvokeFrom.DEBUGGER,
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 InvokeRateLimitError as ex:
raise InvokeRateLimitHttpError(ex.description)
except ValueError as e:
raise e
except Exception:
logger.exception("internal server error.")
raise InternalServerError()
@console_ns.route("/apps/<uuid:app_id>/advanced-chat/workflows/draft/iteration/nodes/<string:node_id>/run")
class AdvancedChatDraftRunIterationNodeApi(Resource):
@console_ns.doc("run_advanced_chat_draft_iteration_node")
@console_ns.doc(description="Run draft workflow iteration node for advanced chat")
@console_ns.doc(params={"app_id": "Application ID", "node_id": "Node ID"})
@console_ns.expect(console_ns.models[IterationNodeRunPayload.__name__])
@console_ns.response(
200,
"Iteration node run started successfully",View on GitHub (pinned to ef8544b173)
Solutions
- Start a new conversation (send conversation_id: null) to continue the session.
- If the completion was unintended, review the workflow terminator/end conditions that marked the conversation completed.
- Clear the front-end conversation_id once the conversation is completed so subsequent runs start a new thread.
Example fix
// before: reusing a completed conversation
{query:'hi', conversation_id: completedId}
// after: begin a new conversation
{query:'hi', conversation_id: null} Defensive patterns
Strategy: validation
Validate before calling
// Check conversation status before running; start new if completed const conv = await getConversation(appId, payload.conversation_id) if (conv?.status === 'completed') payload.conversation_id = null await runDraft(appId, payload)
Try / catch
try {
return await runDraft(appId, payload)
} catch (e) {
if (e.code === 'conversation_completed') {
payload.conversation_id = null; return runDraft(appId, payload)
}
throw e
} Prevention
- Clear the conversation_id once the user finishes a thread.
- Review workflow terminator conditions if conversations complete unexpectedly.
- On completion, start a new conversation rather than reusing the id.
When it happens
Trigger: POSTing a draft run against a conversation_id that is marked completed/ended. The service refuses to add turns to a finished conversation.
Common situations: End-of-conversation triggered by a workflow terminator node; explicit 'end conversation' action; conversation auto-completed by a max-turns rule; client reusing a conversation the user already finished.
Related errors
- Conversation Not Exists.
- patched environment variables require an id
- patched environment variable ids must be unique
- deleted environment variable ids must not be empty
- deleted environment variable ids must be unique
AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12).
Data as JSON: /api/errors/05f6127a3b8505b0.
Report an issue: GitHub.