langgenius/dify · error · NotFound

Conversation Not Exists.

Error message

Conversation Not Exists.

What it means

Returned (HTTP 404, plain `NotFound`) by POST /rag/pipelines/<pipeline_id>/workflows/draft/iteration/nodes/<node_id>/run when the underlying service raises `services.errors.conversation.ConversationNotExistsError`. Iteration node runs operate within a conversation context; if the referenced conversation id is absent (deleted, never created, expired), the run cannot proceed. The controller re-raises as werkzeug NotFound, so the response is a generic 404 with this message.

Source

Thrown at api/controllers/console/datasets/rag_pipeline/rag_pipeline_workflow.py:292

    @with_current_user
    @get_rag_pipeline
    @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)

View on GitHub (pinned to ef8544b173)

Solutions

  1. Start a fresh conversation/run context before invoking the iteration node.
  2. Validate that the conversation still exists via the conversation API before retrying.
  3. Clear cached conversation ids on logout/session expiry.
  4. Surfaces a 'conversation expired, start new' prompt to the user.

Example fix

// before
await post(`${base}/draft/iteration/nodes/${nodeId}/run`, { inputs, conversation_id: staleId })
// after
const conv = await ensureConversation() // creates one if absent
await post(`${base}/draft/iteration/nodes/${nodeId}/run`, { inputs, conversation_id: conv.id })
Defensive patterns

Strategy: try-catch

Validate before calling

if (!conversationId || !(await conversationExists(conversationId))) {
  conversationId = (await createConversation()).id
}
await post(`${base}/draft/iteration/nodes/${nodeId}/run`, { inputs, conversation_id: conversationId })

Try / catch

try {
  await post(`${base}/draft/iteration/nodes/${nodeId}/run`, payload)
} catch (e) {
  if (e.status === 404 && /Conversation Not Exists/.test(e.message)) {
    // create a conversation and retry once
  } else throw e
}

Prevention

When it happens

Trigger: Running an iteration node with a `conversation_id` that was deleted, belongs to another app, or was never created; replaying a request after the conversation was cleared; race with conversation expiration.

Common situations: Frontend caching a conversation_id across sessions. Test runs against ephemeral conversations that have been swept. Long-lived debugger sessions referencing a conversation that timed out.

Related errors


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/ba526b10196ccb3c. Report an issue: GitHub.