{"record":{"id":"4bae40f1da4eb0a7","repo":"langgenius/dify","slug":"message-not-exists-4bae40","errorCode":null,"errorMessage":"Message Not Exists.","messagePattern":"Message Not Exists\\.","errorType":"http","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"api/controllers/console/explore/message.py","lineNumber":142,"sourceCode":"        self, req_data: MessageFeedbackPayload, current_user: Account, installed_app: InstalledApp, message_id: UUID\n    ):\n        app_model = installed_app.app_with_session(session=db.session())\n        if app_model is None:\n            raise AppUnavailableError()\n\n        message_id_str = str(message_id)\n\n        try:\n            MessageService.create_feedback(\n                app_model=app_model,\n                message_id=message_id_str,\n                user=current_user,\n                rating=FeedbackRating(req_data.rating) if req_data.rating else None,\n                content=req_data.content,\n                session=db.session(),\n            )\n        except MessageNotExistsError:\n            raise NotFound(\"Message Not Exists.\")\n\n        return ResultResponse(result=\"success\").model_dump(mode=\"json\")\n\n\n@console_ns.route(\n    \"/installed-apps/<uuid:installed_app_id>/messages/<uuid:message_id>/more-like-this\",\n    endpoint=\"installed_app_more_like_this\",\n)\nclass MessageMoreLikeThisApi(InstalledAppResource):\n    @console_ns.doc(params=query_params_from_model(MoreLikeThisQuery))\n    @console_ns.response(200, \"Success\")\n    @with_current_user\n    @with_session\n    def get(self, session: Session, current_user: Account, installed_app: InstalledApp, message_id: UUID):\n        app_model = installed_app.app_with_session(session=session)\n        if app_model is None:\n            raise AppUnavailableError()\n        if app_model.mode != \"completion\":","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/explore/message.py#L124-L160","documentation":"HTTP 404 raised by POST /installed-apps/<id>/messages/<message_id>/feedbacks when MessageService.create_feedback raises MessageNotExistsError. The message_id path parameter does not resolve to a message in this app.","triggerScenarios":"POST feedback with a message_id (UUID from the path) that does not exist for the app, was deleted, or belongs to a different app/user. The service-level error is translated to NotFound.","commonSituations":"Stale message_id from an old thread; message deleted by retention; user has multiple apps open and message ids crossed; id truncated from URL.","solutions":["Refresh the message list before allowing feedback to ensure the message_id is still present.","On 404, drop the local message and show 'message no longer exists'.","Confirm the message_id is the full UUID from the messages response, not a substring.","Subscribe to message-deletion events to remove feedback affordances proactively."],"exampleFix":"// before: feedback on a cached message row\nawait post(feedbackUrl(id, cachedMessage.id), { rating });\n\n// after: verify message presence first\nconst msgs = await get(messagesUrl(id));\nif (!msgs.data.some(m => m.id === cachedMessage.id)) return;\nawait post(feedbackUrl(id, cachedMessage.id), { rating });","handlingStrategy":"try-catch","validationCode":"// Verify message still exists before submitting feedback\nconst msgs = await get(`/console/explore/installed-apps/${id}/messages`);\nif (!msgs.data.some(m => m.id === messageId)) return;","typeGuard":"function isMessagePresent(messageId, messages) {\n  return messages.some(m => m.id === messageId);\n}","tryCatchPattern":"try {\n  await post(`/installed-apps/${id}/messages/${mid}/feedbacks`, payload);\n} catch (e) {\n  if (e.status === 404 && /Message Not Exists/.test(e.message)) {\n    removeMessageLocally(mid);\n    return;\n  }\n  throw e;\n}","preventionTips":["Refresh the message list before allowing feedback.","Drop local message rows on 404.","Confirm the full UUID is used, not a substring."],"tags":["rest-api","explore","not-found","feedback","message","dify"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}