{"record":{"id":"0251144c555d3944","repo":"langgenius/dify","slug":"message-not-found-025114","errorCode":null,"errorMessage":"Message not found","messagePattern":"Message not found","errorType":"http","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"api/controllers/console/explore/trial.py","lineNumber":639,"sourceCode":"    @with_current_user\n    def get(self, current_user: Account, trial_app, message_id):\n        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","sourceCodeStart":621,"sourceCodeEnd":657,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/explore/trial.py#L621-L657","documentation":"HTTP 404 NotFound with body message 'Message not found', raised when MessageService.get_suggested_questions_after_answer raises MessageNotExistsError. The message_id path parameter does not resolve to a message owned by this app/invoke context. This is a clean not-found at the domain boundary, translated from a service error to an HTTP 404.","triggerScenarios":"GET suggested-questions with a message_id that was deleted, belongs to a different app, or was never created (typo, stale client cache, copied URL). Also occurs when the message belongs to a different tenant or the trial app id and message id are mismatched in the URL.","commonSituations":"Client caches a message id across a conversation reset; the message was hard-deleted by a retention job; the user is testing with a fabricated uuid; the app was re-imported so prior message ids no longer exist.","solutions":["Verify the message_id exists for this app via the message list API before calling suggested-questions, or simply treat 404 as 'refresh the conversation'.","If the id came from a stale client store, clear it and re-fetch the current message id from the conversation history endpoint.","Confirm the message was not deleted by an admin/retention policy."],"exampleFix":"// before\nconst r = await fetch(suggestedUrl)\n\n// after - handle 404 by resetting the conversation\nconst r = await fetch(suggestedUrl)\nif (r.status === 404) { resetConversation(); return }","handlingStrategy":"validation","validationCode":"// Confirm the message exists for this app before calling suggested-questions.\nconst msgs = await fetch(`/console/api/explore/apps/${appId}/chat-messages?conversation_id=${convId}`).then(r => r.json())\nconst exists = (msgs.data || []).some(m => m.id === messageId)\nif (!exists) throw new Error('message not found')","typeGuard":null,"tryCatchPattern":"try {\n  const r = await fetch(suggestedUrl)\n  if (r.status === 404) { resetConversationOrMessage(); return }\n} catch (e) { reportToUser(e) }","preventionTips":["Always source message ids from a fresh conversation history fetch, not long-term client cache.","On conversation reset, invalidate stored message ids.","Treat a 404 here as a soft state, not a hard error."],"tags":["dify","trial-api","console","explore","suggested-questions","message","http-404","not-found"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}