{"record":{"id":"31a3f237c88422a9","repo":"langgenius/dify","slug":"conversation-not-found-31a3f2","errorCode":null,"errorMessage":"Conversation not found","messagePattern":"Conversation not found","errorType":"http","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"api/controllers/console/explore/trial.py","lineNumber":641,"sourceCode":"        app_model = trial_app\n        app_mode = AppMode.value_of(app_model.mode)\n        if app_mode not in {AppMode.CHAT, AppMode.AGENT_CHAT, AppMode.ADVANCED_CHAT}:\n            raise NotChatAppError()\n\n        message_id = str(message_id)\n\n        try:\n            questions = MessageService.get_suggested_questions_after_answer(\n                app_model=app_model,\n                user=current_user,\n                message_id=message_id,\n                invoke_from=InvokeFrom.EXPLORE,\n                session=db.session(),\n            )\n        except MessageNotExistsError:\n            raise NotFound(\"Message not found\")\n        except ConversationNotExistsError:\n            raise NotFound(\"Conversation not found\")\n        except SuggestedQuestionsAfterAnswerDisabledError:\n            raise AppSuggestedQuestionsAfterAnswerDisabledError()\n        except ProviderTokenNotInitError as ex:\n            raise ProviderNotInitializeError(ex.description)\n        except QuotaExceededError:\n            raise ProviderQuotaExceededError()\n        except ModelCurrentlyNotSupportError:\n            raise ProviderModelCurrentlyNotSupportError()\n        except InvokeError as e:\n            raise CompletionRequestError(e.description)\n        except Exception:\n            logger.exception(\"internal server error.\")\n            raise InternalServerError()\n\n        return {\"data\": questions}\n\n\nclass TrialChatAudioApi(TrialAppResource):","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/explore/trial.py#L623-L659","documentation":"HTTP 404 NotFound with body message 'Conversation not found', raised when MessageService.get_suggested_questions_after_answer raises ConversationNotExistsError. The message itself may resolve, but its parent conversation does not (deleted, wrong app, or tenant mismatch). Distinct from the message-level 404: this indicates the conversational container is gone.","triggerScenarios":"GET suggested-questions where the message's conversation_id no longer exists in the DB for this app. Common when the conversation was deleted but the message row lingered, or when the conversation belongs to a different app than the trial app in the URL.","commonSituations":"Conversation deleted by the user or a cleanup task while a client still holds a message link; cross-app id confusion in a multi-tenant deploy; partial DB restore that left orphan messages.","solutions":["Treat 404 with 'Conversation not found' as a signal to start a new conversation - discard the cached conversation/message ids.","If unexpected, check whether a retention job or admin deleted the conversation and whether the message's conversation_id matches the app.","Re-fetch the conversation list for the app to confirm what still exists."],"exampleFix":"// before\nconst r = await fetch(suggestedUrl)\nif (!r.ok) throw new Error('failed')\n\n// after - distinguish conversation-vs-message 404\nconst r = await fetch(suggestedUrl)\nif (r.status === 404) {\n  const body = await r.json()\n  if (body.message === 'Conversation not found') startNewConversation()\n  else discardMessage()\n  return\n}","handlingStrategy":"validation","validationCode":"const convs = await fetch(`/console/api/explore/apps/${appId}/conversations`).then(r => r.json())\nconst exists = (convs.data || []).some(c => c.id === conversationId)\nif (!exists) throw new Error('conversation not found')","typeGuard":null,"tryCatchPattern":"try {\n  const r = await fetch(suggestedUrl)\n  if (r.status === 404) {\n    const body = await r.json()\n    if (body.message === 'Conversation not found') startNewConversation()\n  }\n} catch (e) { reportToUser(e) }","preventionTips":["Invalidate cached conversation/message ids when the user starts a new conversation.","Distinguish conversation-not-found from message-not-found in the 404 handler to drive the right UX.","Be aware retention jobs may delete conversations out from under live clients."],"tags":["dify","trial-api","console","explore","suggested-questions","conversation","http-404","not-found"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}