langgenius/dify · error · NotCompletionAppError

not_completion_app

not_completion_app

Error message

Not Completion App

What it means

HTTP 400 with error_code not_completion_app, raised by GET more-like-this when app_model.mode != 'completion'. The 'more like this' generation feature is only implemented for legacy completion-mode apps; chat, agent-chat, advanced-chat and workflow apps are rejected.

Source

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

        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":
            raise NotCompletionAppError()

        message_id_str = str(message_id)

        args = MoreLikeThisQuery.model_validate(request.args.to_dict())

        streaming = args.response_mode == "streaming"

        try:
            response = AppGenerateService.generate_more_like_this(
                session=session,
                app_model=app_model,
                user=current_user,
                message_id=message_id_str,
                invoke_from=InvokeFrom.EXPLORE,
                streaming=streaming,
            )
            # response-contract:ignore compact_generate_response
            return helper.compact_generate_response(response)

View on GitHub (pinned to ef8544b173)

Solutions

  1. Only show the more-like-this action when app.mode === 'completion'.
  2. Read the mode from GET /installed-apps/<id> (InstalledAppInfoResponse.mode) before calling.
  3. For chat apps, use the suggested-questions endpoint or the normal chat-generation flow instead.
  4. If the app should be completion mode, verify the owner did not change the mode.

Example fix

// before: offer more-like-this for every app
{messages.map(m => <MoreLikeThisButton appId={id} messageId={m.id} />)}

// after: completion apps only
{app.mode === 'completion' && messages.map(m => (
  <MoreLikeThisButton appId={id} messageId={m.id} />
))}
Defensive patterns

Strategy: type-guard

Validate before calling

function isCompletionApp(app) { return app?.mode === 'completion'; }
if (!isCompletionApp(app)) return; // skip more-like-this for non-completion apps

Type guard

function isCompletionApp(app) {
  return Boolean(app) && app.mode === 'completion';
}

Try / catch

try {
  return await get(moreLikeThisUrl(id, mid));
} catch (e) {
  if (e.code === 'not_completion_app') { hideMoreLikeThis(id); return null; }
  throw e;
}

Prevention

When it happens

Trigger: GET /installed-apps/<id>/messages/<mid>/more-like-this on any app whose mode is not exactly 'completion'. The mode check runs after the app is loaded.

Common situations: Calling more-like-this on a chat or workflow app; app migrated from completion to chat; UI surfaces the action for all installed apps regardless of mode.

Related errors


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