langgenius/dify · warning · AppSuggestedQuestionsAfterAnswerDisabledError

app_suggested_questions_after_answer_disabled

app_suggested_questions_after_answer_disabled

Error message

Function Suggested questions after answer disabled.

What it means

Raised as AppSuggestedQuestionsAfterAnswerDisabledError when SuggestedQuestionsAfterAnswerDisabledError bubbles out of MessageService.get_suggested_questions_after_answer (api/controllers/console/app/message.py:530-531). The app model config has the 'suggested questions after answer' feature disabled, so the service refuses to generate suggestions. It is a config-state error, not a model/provider error.

Source

Thrown at api/controllers/console/app/message.py:531

            message_id=message_id_str,
            user=current_user,
            invoke_from=InvokeFrom.DEBUGGER,
            session=session,
        )
    except MessageNotExistsError:
        raise NotFound("Message not found")
    except ConversationNotExistsError:
        raise NotFound("Conversation not found")
    except ProviderTokenNotInitError as ex:
        raise ProviderNotInitializeError(ex.description)
    except QuotaExceededError:
        raise ProviderQuotaExceededError()
    except ModelCurrentlyNotSupportError:
        raise ProviderModelCurrentlyNotSupportError()
    except InvokeError as e:
        raise CompletionRequestError(e.description)
    except SuggestedQuestionsAfterAnswerDisabledError:
        raise AppSuggestedQuestionsAfterAnswerDisabledError()
    except Exception:
        logger.exception("internal server error.")
        raise InternalServerError()

    return dump_response(SuggestedQuestionsResponse, {"data": questions})


def _get_message_detail(*, session: Session, app_model: App, message_id: UUID):
    message_id_str = str(message_id)

    message = session.scalar(
        select(Message).where(Message.id == message_id_str, Message.app_id == app_model.id).limit(1)
    )

    if not message:
        raise NotFound("Message Not Exists.")

    attach_message_extra_contents([message])

View on GitHub (pinned to ef8544b173)

Solutions

  1. Enable 'Suggested questions after answer' in the app's model configuration (AppModelConfig.suggested_questions_after_answer = True) and retry.
  2. Stop calling the endpoint from the client when the feature flag is off — gate the UI button on the same config flag.
  3. If the feature was intentionally disabled, treat this response as expected and suppress the error in the client.

Example fix

// before: client always calls the endpoint
fetch(`/apps/${appId}/messages/${msgId}/suggested-questions`)
// after: only call when feature is enabled in app config
if (appConfig.suggested_questions_after_answer) {
  fetch(`/apps/${appId}/messages/${msgId}/suggested-questions`)
}
Defensive patterns

Strategy: validation

Validate before calling

// Gate the call on the feature flag from app config
if (!appConfig.suggested_questions_after_answer) {
  return [] // do not call the endpoint
}
return await fetch(`/apps/${appId}/messages/${msgId}/suggested-questions`).then(r=>r.json())

Try / catch

try {
  return await callSuggestedQuestions()
} catch (e) {
  if (e.code === 'app_suggested_questions_after_answer_disabled') return []
  throw e
}

Prevention

When it happens

Trigger: Calling the suggested-questions endpoint for an app whose ModelConfig.suggested_questions_after_answer flag is False (or unset). Happens when the feature was turned off in the app settings or never enabled for that app mode.

Common situations: Feature toggled off by an admin to save token cost; default-off for new apps in some templates; stale front-end calling the endpoint after the flag was disabled; environment/config drift after import.

Related errors


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