langgenius/dify · error · NotFound

Message Not Exists.

Error message

Message Not Exists.

What it means

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.

Source

Thrown at api/controllers/console/explore/message.py:142

        self, req_data: MessageFeedbackPayload, current_user: Account, installed_app: InstalledApp, message_id: UUID
    ):
        app_model = installed_app.app_with_session(session=db.session())
        if app_model is None:
            raise AppUnavailableError()

        message_id_str = str(message_id)

        try:
            MessageService.create_feedback(
                app_model=app_model,
                message_id=message_id_str,
                user=current_user,
                rating=FeedbackRating(req_data.rating) if req_data.rating else None,
                content=req_data.content,
                session=db.session(),
            )
        except MessageNotExistsError:
            raise NotFound("Message Not Exists.")

        return ResultResponse(result="success").model_dump(mode="json")


@console_ns.route(
    "/installed-apps/<uuid:installed_app_id>/messages/<uuid:message_id>/more-like-this",
    endpoint="installed_app_more_like_this",
)
class MessageMoreLikeThisApi(InstalledAppResource):
    @console_ns.doc(params=query_params_from_model(MoreLikeThisQuery))
    @console_ns.response(200, "Success")
    @with_current_user
    @with_session
    def get(self, session: Session, current_user: Account, installed_app: InstalledApp, message_id: UUID):
        app_model = installed_app.app_with_session(session=session)
        if app_model is None:
            raise AppUnavailableError()
        if app_model.mode != "completion":

View on GitHub (pinned to ef8544b173)

Solutions

  1. Refresh the message list before allowing feedback to ensure the message_id is still present.
  2. On 404, drop the local message and show 'message no longer exists'.
  3. Confirm the message_id is the full UUID from the messages response, not a substring.
  4. Subscribe to message-deletion events to remove feedback affordances proactively.

Example fix

// before: feedback on a cached message row
await post(feedbackUrl(id, cachedMessage.id), { rating });

// after: verify message presence first
const msgs = await get(messagesUrl(id));
if (!msgs.data.some(m => m.id === cachedMessage.id)) return;
await post(feedbackUrl(id, cachedMessage.id), { rating });
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify message still exists before submitting feedback
const msgs = await get(`/console/explore/installed-apps/${id}/messages`);
if (!msgs.data.some(m => m.id === messageId)) return;

Type guard

function isMessagePresent(messageId, messages) {
  return messages.some(m => m.id === messageId);
}

Try / catch

try {
  await post(`/installed-apps/${id}/messages/${mid}/feedbacks`, payload);
} catch (e) {
  if (e.status === 404 && /Message Not Exists/.test(e.message)) {
    removeMessageLocally(mid);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Stale message_id from an old thread; message deleted by retention; user has multiple apps open and message ids crossed; id truncated from URL.

Related errors


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