{"record":{"id":"0f231531512e8939","repo":"langgenius/dify","slug":"app-suggested-questions-after-answer-disabled","errorCode":"app_suggested_questions_after_answer_disabled","errorMessage":"Function Suggested questions after answer disabled.","messagePattern":"Function Suggested questions after answer disabled\\.","errorType":"error_code","errorClass":"AppSuggestedQuestionsAfterAnswerDisabledError","httpStatus":403,"severity":"warning","filePath":"api/controllers/console/app/message.py","lineNumber":531,"sourceCode":"            message_id=message_id_str,\n            user=current_user,\n            invoke_from=InvokeFrom.DEBUGGER,\n            session=session,\n        )\n    except MessageNotExistsError:\n        raise NotFound(\"Message not found\")\n    except ConversationNotExistsError:\n        raise NotFound(\"Conversation not found\")\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 SuggestedQuestionsAfterAnswerDisabledError:\n        raise AppSuggestedQuestionsAfterAnswerDisabledError()\n    except Exception:\n        logger.exception(\"internal server error.\")\n        raise InternalServerError()\n\n    return dump_response(SuggestedQuestionsResponse, {\"data\": questions})\n\n\ndef _get_message_detail(*, session: Session, app_model: App, message_id: UUID):\n    message_id_str = str(message_id)\n\n    message = session.scalar(\n        select(Message).where(Message.id == message_id_str, Message.app_id == app_model.id).limit(1)\n    )\n\n    if not message:\n        raise NotFound(\"Message Not Exists.\")\n\n    attach_message_extra_contents([message])","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/langgenius/dify/blob/ef8544b173fd6cd7a8e71df2cab576e52bebbfbc/api/controllers/console/app/message.py#L513-L549","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Enable 'Suggested questions after answer' in the app's model configuration (AppModelConfig.suggested_questions_after_answer = True) and retry.","Stop calling the endpoint from the client when the feature flag is off — gate the UI button on the same config flag.","If the feature was intentionally disabled, treat this response as expected and suppress the error in the client."],"exampleFix":"// before: client always calls the endpoint\nfetch(`/apps/${appId}/messages/${msgId}/suggested-questions`)\n// after: only call when feature is enabled in app config\nif (appConfig.suggested_questions_after_answer) {\n  fetch(`/apps/${appId}/messages/${msgId}/suggested-questions`)\n}","handlingStrategy":"validation","validationCode":"// Gate the call on the feature flag from app config\nif (!appConfig.suggested_questions_after_answer) {\n  return [] // do not call the endpoint\n}\nreturn await fetch(`/apps/${appId}/messages/${msgId}/suggested-questions`).then(r=>r.json())","typeGuard":null,"tryCatchPattern":"try {\n  return await callSuggestedQuestions()\n} catch (e) {\n  if (e.code === 'app_suggested_questions_after_answer_disabled') return []\n  throw e\n}","preventionTips":["Read the feature flag from app config and reflect it in the UI (hide the button).","Treat disabled-feature responses as expected, not as errors."],"tags":["feature-flag","suggested-questions","config","api"],"backgroundTag":null,"analyzedSha":"ef8544b173fd6cd7a8e71df2cab576e52bebbfbc","analyzedAt":"2026-08-12T05:15:17.394Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}